本文整理汇总了Java中com.google.zxing.pdf417.PDF417ResultMetadata.setSegmentIndex方法的典型用法代码示例。如果您正苦于以下问题:Java PDF417ResultMetadata.setSegmentIndex方法的具体用法?Java PDF417ResultMetadata.setSegmentIndex怎么用?Java PDF417ResultMetadata.setSegmentIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.pdf417.PDF417ResultMetadata
的用法示例。
在下文中一共展示了PDF417ResultMetadata.setSegmentIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeMacroBlock
import com.google.zxing.pdf417.PDF417ResultMetadata; //导入方法依赖的package包/类
private static int decodeMacroBlock(int[] codewords, int codeIndex, PDF417ResultMetadata resultMetadata)
throws FormatException {
if (codeIndex + NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) {
// we must have at least two bytes left for the segment index
throw FormatException.getFormatInstance();
}
int[] segmentIndexArray = new int[NUMBER_OF_SEQUENCE_CODEWORDS];
for (int i = 0; i < NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) {
segmentIndexArray[i] = codewords[codeIndex];
}
resultMetadata.setSegmentIndex(Integer.parseInt(decodeBase900toBase10(segmentIndexArray,
NUMBER_OF_SEQUENCE_CODEWORDS)));
StringBuilder fileId = new StringBuilder();
codeIndex = textCompaction(codewords, codeIndex, fileId);
resultMetadata.setFileId(fileId.toString());
if (codewords[codeIndex] == BEGIN_MACRO_PDF417_OPTIONAL_FIELD) {
codeIndex++;
int[] additionalOptionCodeWords = new int[codewords[0] - codeIndex];
int additionalOptionCodeWordsIndex = 0;
boolean end = false;
while ((codeIndex < codewords[0]) && !end) {
int code = codewords[codeIndex++];
if (code < TEXT_COMPACTION_MODE_LATCH) {
additionalOptionCodeWords[additionalOptionCodeWordsIndex++] = code;
} else {
switch (code) {
case MACRO_PDF417_TERMINATOR:
resultMetadata.setLastSegment(true);
codeIndex++;
end = true;
break;
default:
throw FormatException.getFormatInstance();
}
}
}
resultMetadata.setOptionalData(Arrays.copyOf(additionalOptionCodeWords, additionalOptionCodeWordsIndex));
} else if (codewords[codeIndex] == MACRO_PDF417_TERMINATOR) {
resultMetadata.setLastSegment(true);
codeIndex++;
}
return codeIndex;
}
示例2: decodeMacroBlock
import com.google.zxing.pdf417.PDF417ResultMetadata; //导入方法依赖的package包/类
private static int decodeMacroBlock(int[] codewords, int codeIndex, PDF417ResultMetadata
resultMetadata) throws FormatException {
if (codeIndex + 2 > codewords[0]) {
throw FormatException.getFormatInstance();
}
int[] segmentIndexArray = new int[2];
int i = 0;
while (i < 2) {
segmentIndexArray[i] = codewords[codeIndex];
i++;
codeIndex++;
}
resultMetadata.setSegmentIndex(Integer.parseInt(decodeBase900toBase10(segmentIndexArray,
2)));
StringBuilder fileId = new StringBuilder();
codeIndex = textCompaction(codewords, codeIndex, fileId);
resultMetadata.setFileId(fileId.toString());
if (codewords[codeIndex] == BEGIN_MACRO_PDF417_OPTIONAL_FIELD) {
codeIndex++;
int[] additionalOptionCodeWords = new int[(codewords[0] - codeIndex)];
int additionalOptionCodeWordsIndex = 0;
boolean end = false;
while (codeIndex < codewords[0] && !end) {
int codeIndex2 = codeIndex + 1;
int code = codewords[codeIndex];
if (code < TEXT_COMPACTION_MODE_LATCH) {
int additionalOptionCodeWordsIndex2 = additionalOptionCodeWordsIndex + 1;
additionalOptionCodeWords[additionalOptionCodeWordsIndex] = code;
additionalOptionCodeWordsIndex = additionalOptionCodeWordsIndex2;
codeIndex = codeIndex2;
} else {
switch (code) {
case MACRO_PDF417_TERMINATOR /*922*/:
resultMetadata.setLastSegment(true);
codeIndex = codeIndex2 + 1;
end = true;
break;
default:
throw FormatException.getFormatInstance();
}
}
}
resultMetadata.setOptionalData(Arrays.copyOf(additionalOptionCodeWords,
additionalOptionCodeWordsIndex));
return codeIndex;
} else if (codewords[codeIndex] != MACRO_PDF417_TERMINATOR) {
return codeIndex;
} else {
resultMetadata.setLastSegment(true);
return codeIndex + 1;
}
}
示例3: decodeMacroBlock
import com.google.zxing.pdf417.PDF417ResultMetadata; //导入方法依赖的package包/类
private static int decodeMacroBlock(int[] codewords, int codeIndex, PDF417ResultMetadata resultMetadata)
throws FormatException {
if (codeIndex + NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) {
// we must have at least two bytes left for the segment index
throw FormatException.getFormatInstance();
}
int[] segmentIndexArray = new int[NUMBER_OF_SEQUENCE_CODEWORDS];
for (int i = 0; i < NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) {
segmentIndexArray[i] = codewords[codeIndex];
}
resultMetadata.setSegmentIndex(Integer.parseInt(decodeBase900toBase10(segmentIndexArray,
NUMBER_OF_SEQUENCE_CODEWORDS)));
StringBuilder fileId = new StringBuilder();
codeIndex = textCompaction(codewords, codeIndex, fileId);
resultMetadata.setFileId(fileId.toString());
if (codewords[codeIndex] == BEGIN_MACRO_PDF417_OPTIONAL_FIELD) {
codeIndex++;
int[] additionalOptionCodeWords = new int[codewords[0] - codeIndex];
int additionalOptionCodeWordsIndex = 0;
boolean end = false;
while ((codeIndex < codewords[0]) && !end) {
int code = codewords[codeIndex++];
if (code < TEXT_COMPACTION_MODE_LATCH) {
additionalOptionCodeWords[additionalOptionCodeWordsIndex++] = code;
} else {
switch (code) {
case MACRO_PDF417_TERMINATOR:
resultMetadata.setLastSegment(true);
codeIndex++;
end = true;
break;
default:
throw FormatException.getFormatInstance();
}
}
}
resultMetadata.setOptionalData(Arrays.copyOf(additionalOptionCodeWords, additionalOptionCodeWordsIndex));
} else if (codewords[codeIndex] == MACRO_PDF417_TERMINATOR) {
resultMetadata.setLastSegment(true);
codeIndex++;
}
return codeIndex;
}