public class ISOBinaryFieldPackager extends ISOFieldPackager
pad, trim
Constructor and Description |
---|
ISOBinaryFieldPackager()
Constructs a default ISOBinaryFieldPackager.
|
ISOBinaryFieldPackager(BinaryInterpreter interpreter,
Prefixer prefixer)
Creates an ISOBinaryFieldPackager.
|
ISOBinaryFieldPackager(int maxLength,
java.lang.String description,
BinaryInterpreter interpreter,
Prefixer prefixer)
Creates an ISOBinaryFieldPackager.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkLength(int len,
int maxLength)
Checks the length of the data against the maximum, and throws an IllegalArgumentException.
|
ISOComponent |
createComponent(int fieldNumber)
component factory
|
int |
getMaxPackedLength() |
byte[] |
pack(ISOComponent c)
Convert the component into a byte[].
|
void |
setInterpreter(BinaryInterpreter interpreter)
Sets the Interpreter.
|
void |
setPrefixer(Prefixer prefixer)
Sets the length prefixer.
|
int |
unpack(ISOComponent c,
byte[] b,
int offset) |
void |
unpack(ISOComponent c,
java.io.InputStream in)
Unpack from an input stream
|
getDescription, getLength, pack, readBytes, setDescription, setLength, setPad, setTrim
public ISOBinaryFieldPackager()
public ISOBinaryFieldPackager(int maxLength, java.lang.String description, 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.interpreter
- The interpreter used to encode the field.prefixer
- The type of length prefixer used to encode this field.public ISOBinaryFieldPackager(BinaryInterpreter interpreter, Prefixer prefixer)
interpreter
- The interpreter used to encode the field.prefixer
- The type of length prefixer used to encode this field.public void setInterpreter(BinaryInterpreter interpreter)
interpreter
- The interpreter to use in packing and unpacking.public void setPrefixer(Prefixer prefixer)
prefixer
- The length prefixer to use during packing and unpacking.public int getMaxPackedLength()
getMaxPackedLength
in class ISOFieldPackager
public byte[] pack(ISOComponent c) throws ISOException
pack
in class ISOFieldPackager
c
- - a componentISOException
public int unpack(ISOComponent c, byte[] b, int offset) throws ISOException
unpack
in class ISOFieldPackager
c
- - the Component to unpackb
- - binary imageoffset
- - starting offset within the binary imageISOException
public void unpack(ISOComponent c, java.io.InputStream in) throws java.io.IOException, ISOException
unpack
in class ISOFieldPackager
c
- - the Component to unpackin
- - input streamISOException
java.io.IOException
public ISOComponent createComponent(int fieldNumber)
createComponent
in class ISOFieldPackager
fieldNumber
- - the field numberprotected void checkLength(int len, int maxLength) throws java.lang.IllegalArgumentException
len
- The length of the data for this field packager.maxLength
- The maximum length allowed for this type of field packager.
This depends on the prefixer that is used.java.lang.IllegalArgumentException
- If len > maxLength.