2 * Copyright 2008 ZXing authors
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.optional;
19 import com.google.zxing.client.result.ResultParser;
22 * <p>Superclass for classes encapsulating reader results encoded according
23 * to the MobileTag Reader International Specification.</p>
27 abstract class AbstractMobileTagResultParser extends ResultParser {
29 public static final int ACTION_DO = 1;
30 public static final int ACTION_EDIT = 2;
31 public static final int ACTION_SAVE = 4;
33 static String[] matchDelimitedFields(String rawText, int maxItems) {
34 String[] result = new String[maxItems];
37 int max = rawText.length();
38 while (item < maxItems && i < max) {
39 int start = i; // Found the start of a match here
42 i = rawText.indexOf((int) '|', i);
44 // No terminating end character? done. Set i such that loop terminates and break
47 } else if (rawText.charAt(i - 1) == '\\') {
48 // semicolon was escaped so continue
53 result[item] = unescapeBackslash(rawText.substring(start, i));
61 if (item < maxItems) {
67 static boolean isDigits(String s, int expectedLength) {
71 if (s.length() != expectedLength) {
74 for (int i = 0; i < expectedLength; i++) {
75 if (!Character.isDigit(s.charAt(i))) {