2 * Copyright 2008 Google Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.google.zxing.client.result;
19 import java.io.UnsupportedEncodingException;
22 * <p>Superclass for classes encapsulating results in the NDEF format.
23 * See <a href="http://www.nfc-forum.org/specs/">http://www.nfc-forum.org/specs/</a>.</p>
25 * <p>This code supports a limited subset of NDEF messages, ones that are plausibly
26 * useful in 2D barcode formats. This generally includes 1-record messages, no chunking,
27 * "short record" syntax, no ID field.</p>
29 * @author srowen@google.com (Sean Owen)
31 abstract class AbstractNDEFParsedResult extends ParsedReaderResult {
33 AbstractNDEFParsedResult(ParsedReaderResultType type) {
37 static String bytesToString(byte[] bytes, int offset, int length, String encoding) {
39 return new String(bytes, offset, length, encoding);
40 } catch (UnsupportedEncodingException uee) {
41 // This should only be used when 'encoding' is an encoding that must necessarily
42 // be supported by the JVM, like UTF-8
43 throw new RuntimeException("Platform does not support required encoding: " + uee);