public class ISOTagBinaryFieldPackager extends ISOBinaryFieldPackager
Format TTLL....
Where
TT is the n>0 digit field number (Tag)
LL is the n>=0 digit field length (if n=0 it's means fixed length field with prefixer)
.. is the field content
pad, trim
Constructor and Description |
---|
ISOTagBinaryFieldPackager()
Constructs a default ISOTagBinaryFieldPackager.
|
ISOTagBinaryFieldPackager(int maxLength,
java.lang.String description,
Prefixer tagPrefixer,
Padder padder,
BinaryInterpreter interpreter,
Prefixer prefixer)
Creates an ISOTagBinaryFieldPackager.
|
ISOTagBinaryFieldPackager(Prefixer tagPrefixer,
Padder padder,
BinaryInterpreter interpreter,
Prefixer prefixer)
Constructs an ISOTagBinaryFieldPackager with a specific Padder, Interpreter and Prefixer.
|
Modifier and Type | Method and Description |
---|---|
int |
getMaxPackedLength()
Returns the prefixer's packed length and the interpreter's packed length.
|
byte[] |
pack(ISOComponent c)
Convert the component into a byte[].
|
void |
setInterpreter(BinaryInterpreter interpreter)
Sets the Interpreter.
|
void |
setPadder(Padder padder)
Sets the Padder.
|
void |
setPrefixer(Prefixer prefixer)
Sets the length prefixer.
|
int |
unpack(ISOComponent c,
byte[] b,
int offset)
Unpacks the byte array into the component.
|
void |
unpack(ISOComponent c,
java.io.InputStream in)
Unpack the input stream into the component.
|
checkLength, createComponent
getDescription, getLength, pack, readBytes, setDescription, setLength, setPad, setTrim
public ISOTagBinaryFieldPackager()
public ISOTagBinaryFieldPackager(Prefixer tagPrefixer, Padder padder, BinaryInterpreter interpreter, Prefixer prefixer)
tagPrefixer
- The type of tag prefixer used to encode tag.padder
- The type of padding used.interpreter
- The interpreter used to encode the field.prefixer
- The type of length prefixer used to encode this field.public ISOTagBinaryFieldPackager(int maxLength, java.lang.String description, Prefixer tagPrefixer, Padder padder, BinaryInterpreter interpreter, Prefixer prefixer)
maxLength
- The maximum length of the field in characters or bytes depending on the datatype.description
- The description of the field. For human readable output.tagPrefixer
- The type of tag prefixer used to encode tag.interpreter
- The interpreter used to encode the field.padder
- The type of padding used.prefixer
- The type of length prefixer used to encode this field.public void setPadder(Padder padder)
padder
- The padder to use during packing and unpacking.public void setInterpreter(BinaryInterpreter interpreter)
setInterpreter
in class ISOBinaryFieldPackager
interpreter
- The interpreter to use in packing and unpacking.public void setPrefixer(Prefixer prefixer)
setPrefixer
in class ISOBinaryFieldPackager
prefixer
- The length prefixer to use during packing and unpacking.public int getMaxPackedLength()
getMaxPackedLength
in class ISOBinaryFieldPackager
ISOFieldPackager.getMaxPackedLength()
public byte[] pack(ISOComponent c) throws ISOException
pack
in class ISOBinaryFieldPackager
c
- - a componentISOException
public int unpack(ISOComponent c, byte[] b, int offset) throws ISOException
unpack
in class ISOBinaryFieldPackager
c
- The component to unpack into.b
- The byte array to unpack.offset
- The index in the byte array to start unpacking from.ISOException
public void unpack(ISOComponent c, java.io.InputStream in) throws java.io.IOException, ISOException
unpack
in class ISOBinaryFieldPackager
c
- The Component to unpack into.in
- Input stream where the packed bytes come from.java.io.IOException
- Thrown if there's a problem reading the input stream.ISOException