|
|
@ -182,23 +182,23 @@ public final class QrSegmentAdvanced {
|
|
|
|
QrSegment.Mode curMode = charModes[0];
|
|
|
|
QrSegment.Mode curMode = charModes[0];
|
|
|
|
int start = 0;
|
|
|
|
int start = 0;
|
|
|
|
for (int i = 1; ; i++) {
|
|
|
|
for (int i = 1; ; i++) {
|
|
|
|
if (i >= data.length || charModes[i] != curMode) {
|
|
|
|
if (i < data.length && charModes[i] == curMode)
|
|
|
|
if (curMode == BYTE)
|
|
|
|
continue;
|
|
|
|
result.add(QrSegment.makeBytes(Arrays.copyOfRange(data, start, i)));
|
|
|
|
if (curMode == BYTE)
|
|
|
|
else {
|
|
|
|
result.add(QrSegment.makeBytes(Arrays.copyOfRange(data, start, i)));
|
|
|
|
String temp = new String(data, start, i - start, StandardCharsets.US_ASCII);
|
|
|
|
else {
|
|
|
|
if (curMode == NUMERIC)
|
|
|
|
String temp = new String(data, start, i - start, StandardCharsets.US_ASCII);
|
|
|
|
result.add(QrSegment.makeNumeric(temp));
|
|
|
|
if (curMode == NUMERIC)
|
|
|
|
else if (curMode == ALPHANUMERIC)
|
|
|
|
result.add(QrSegment.makeNumeric(temp));
|
|
|
|
result.add(QrSegment.makeAlphanumeric(temp));
|
|
|
|
else if (curMode == ALPHANUMERIC)
|
|
|
|
else
|
|
|
|
result.add(QrSegment.makeAlphanumeric(temp));
|
|
|
|
throw new AssertionError();
|
|
|
|
else
|
|
|
|
}
|
|
|
|
throw new AssertionError();
|
|
|
|
if (i >= data.length)
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
curMode = charModes[i];
|
|
|
|
|
|
|
|
start = i;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i >= data.length)
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
curMode = charModes[i];
|
|
|
|
|
|
|
|
start = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|