Skip to content

Commit

Permalink
Add multi-eci decoding for PDF417 (#1507)
Browse files Browse the repository at this point in the history
* - Added multi-eci decoding for PDF417
- Fixed issue that some multi-eci encoded PDF417 codes were missing ECIs

* Syntactic changes

* - Fixed issue that ECIs were not processed correctly in all allowed locations in binary encoded data as specified in section 5.5.3.2 of the spec
- Added verifying unit test
  • Loading branch information
AlexGeller1 committed Mar 9, 2022
1 parent 92854d4 commit ce1a1a5
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 149 deletions.
21 changes: 21 additions & 0 deletions core/src/main/java/com/google/zxing/common/MinimalECIInput.java
Expand Up @@ -208,6 +208,27 @@ public int getECIValue(int index) {
return bytes[index] - 256;
}

@Override
public String toString() {
StringBuilder result = new StringBuilder();
for (int i = 0; i < length(); i++) {
if (i > 0) {
result.append(", ");
}
if (isECI(i)) {
result.append("ECI(");
result.append(getECIValue(i));
result.append(')');
} else if (charAt(i) < 128) {
result.append('\'');
result.append(charAt(i));
result.append('\'');
} else {
result.append((int) charAt(i));
}
}
return result.toString();
}
static void addEdge(InputEdge[][] edges, int to, InputEdge edge) {
if (edges[to][edge.encoderIndex] == null ||
edges[to][edge.encoderIndex].cachedTotalSize > edge.cachedTotalSize) {
Expand Down

0 comments on commit ce1a1a5

Please sign in to comment.