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, setTrimpublic 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 ISOFieldPackagerpublic byte[] pack(ISOComponent c) throws ISOException
pack in class ISOFieldPackagerc - - a componentISOExceptionpublic int unpack(ISOComponent c, byte[] b, int offset) throws ISOException
unpack in class ISOFieldPackagerc - - the Component to unpackb - - binary imageoffset - - starting offset within the binary imageISOExceptionpublic void unpack(ISOComponent c, java.io.InputStream in) throws java.io.IOException, ISOException
unpack in class ISOFieldPackagerc - - the Component to unpackin - - input streamISOExceptionjava.io.IOExceptionpublic ISOComponent createComponent(int fieldNumber)
createComponent in class ISOFieldPackagerfieldNumber - - 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.