mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
move all Result to RXingResult
This commit is contained in:
@@ -57,12 +57,12 @@ final class DataBlock {
|
||||
|
||||
// Now establish DataBlocks of the appropriate size and number of data codewords
|
||||
DataBlock[] result = new DataBlock[totalBlocks];
|
||||
int numResultBlocks = 0;
|
||||
int numRXingResultBlocks = 0;
|
||||
for (Version.ECB ecBlock : ecBlockArray) {
|
||||
for (int i = 0; i < ecBlock.getCount(); i++) {
|
||||
int numDataCodewords = ecBlock.getDataCodewords();
|
||||
int numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;
|
||||
result[numResultBlocks++] = new DataBlock(numDataCodewords, new byte[numBlockCodewords]);
|
||||
result[numRXingResultBlocks++] = new DataBlock(numDataCodewords, new byte[numBlockCodewords]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,14 +78,14 @@ final class DataBlock {
|
||||
// first fill out as many elements as all of them have minus 1
|
||||
int rawCodewordsOffset = 0;
|
||||
for (int i = 0; i < shorterBlocksNumDataCodewords; i++) {
|
||||
for (int j = 0; j < numResultBlocks; j++) {
|
||||
for (int j = 0; j < numRXingResultBlocks; j++) {
|
||||
result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];
|
||||
}
|
||||
}
|
||||
|
||||
// Fill out the last data block in the longer ones
|
||||
boolean specialVersion = version.getVersionNumber() == 24;
|
||||
int numLongerBlocks = specialVersion ? 8 : numResultBlocks;
|
||||
int numLongerBlocks = specialVersion ? 8 : numRXingResultBlocks;
|
||||
for (int j = 0; j < numLongerBlocks; j++) {
|
||||
result[j].codewords[longerBlocksNumDataCodewords - 1] = rawCodewords[rawCodewordsOffset++];
|
||||
}
|
||||
@@ -93,8 +93,8 @@ final class DataBlock {
|
||||
// Now add in error correction blocks
|
||||
int max = result[0].codewords.length;
|
||||
for (int i = longerBlocksNumDataCodewords; i < max; i++) {
|
||||
for (int j = 0; j < numResultBlocks; j++) {
|
||||
int jOffset = specialVersion ? (j + 8) % numResultBlocks : j;
|
||||
for (int j = 0; j < numRXingResultBlocks; j++) {
|
||||
int jOffset = specialVersion ? (j + 8) % numRXingResultBlocks : j;
|
||||
int iOffset = specialVersion && jOffset > 7 ? i - 1 : i;
|
||||
result[jOffset].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.google.zxing.datamatrix.decoder;
|
||||
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.common.BitSource;
|
||||
import com.google.zxing.common.DecoderResult;
|
||||
import com.google.zxing.common.DecoderRXingResult;
|
||||
import com.google.zxing.common.ECIStringBuilder;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -86,7 +86,7 @@ final class DecodedBitStreamParser {
|
||||
private DecodedBitStreamParser() {
|
||||
}
|
||||
|
||||
static DecoderResult decode(byte[] bytes) throws FormatException {
|
||||
static DecoderRXingResult decode(byte[] bytes) throws FormatException {
|
||||
BitSource bits = new BitSource(bytes);
|
||||
ECIStringBuilder result = new ECIStringBuilder(100);
|
||||
StringBuilder resultTrailer = new StringBuilder(0);
|
||||
@@ -149,7 +149,7 @@ final class DecodedBitStreamParser {
|
||||
}
|
||||
}
|
||||
|
||||
return new DecoderResult(bytes,
|
||||
return new DecoderRXingResult(bytes,
|
||||
result.toString(),
|
||||
byteSegments.isEmpty() ? null : byteSegments,
|
||||
null,
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.google.zxing.datamatrix.decoder;
|
||||
import com.google.zxing.ChecksumException;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.common.DecoderResult;
|
||||
import com.google.zxing.common.DecoderRXingResult;
|
||||
import com.google.zxing.common.reedsolomon.GenericGF;
|
||||
import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
|
||||
import com.google.zxing.common.reedsolomon.ReedSolomonException;
|
||||
@@ -47,7 +47,7 @@ public final class Decoder {
|
||||
* @throws FormatException if the Data Matrix Code cannot be decoded
|
||||
* @throws ChecksumException if error correction fails
|
||||
*/
|
||||
public DecoderResult decode(boolean[][] image) throws FormatException, ChecksumException {
|
||||
public DecoderRXingResult decode(boolean[][] image) throws FormatException, ChecksumException {
|
||||
return decode(BitMatrix.parse(image));
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public final class Decoder {
|
||||
* @throws FormatException if the Data Matrix Code cannot be decoded
|
||||
* @throws ChecksumException if error correction fails
|
||||
*/
|
||||
public DecoderResult decode(BitMatrix bits) throws FormatException, ChecksumException {
|
||||
public DecoderRXingResult decode(BitMatrix bits) throws FormatException, ChecksumException {
|
||||
|
||||
// Construct a parser and read version, error-correction level
|
||||
BitMatrixParser parser = new BitMatrixParser(bits);
|
||||
|
||||
Reference in New Issue
Block a user