Skip to content

Support self-inclusive binary prefixes#740

Merged
ar merged 1 commit into
mainfrom
issue-739-self-inclusive-binary-prefixer
Jul 17, 2026
Merged

Support self-inclusive binary prefixes#740
ar merged 1 commit into
mainfrom
issue-739-self-inclusive-binary-prefixer

Conversation

@ar-agt

@ar-agt ar-agt commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Closes #739

Adds one- and two-byte self-inclusive binary prefixers and exposes them through inclusive="true" on GenericPackager binary fields. The encoded length includes the prefix itself; unpacking subtracts it.

Tests: ./gradlew test (Java 26.0.1-amzn, Gradle 9.5.1).

@ar
ar merged commit b6ada59 into main Jul 17, 2026
1 check passed
ONGOING-Z pushed a commit to SourceDive/jPOS that referenced this pull request Jul 18, 2026
Follow-ups to jpos#740:

- SelfInclusiveBinaryPrefixer.of(BinaryPrefixer) reuses the B/BB
  singletons and wraps any binary prefixer; maxLength() generalized to
  n-byte prefixes.
- ISOBinaryFieldPackager selects the inclusive prefixer via instanceof
  rather than singleton identity, so any binary length prefix works, and
  throws ISOException on a non-binary prefix.
- GenericPackagerParams.setGenericPackagerParams now declares
  throws ISOException, matching the packager-XML error convention;
  overriding implementations are unaffected (fewer checked exceptions).
- Tests: inclusive="true" on an isofieldpackager with subfields
  (Visa field 126.18 shape, round-trip) and rejection on a
  non-binary-prefix field.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support self-inclusive length prefix for binary field packagers

2 participants