|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.solab.iso8583.IsoMessage
public class IsoMessage
Represents an ISO8583 message. This is the core class of the framework. Contains the bitmap which is modified as fields are added/removed. This class makes no assumptions as to what types belong in each field, nor what fields should each different message type have; that is left for the developer, since the different ISO8583 implementations can vary greatly.
Constructor Summary | |
---|---|
IsoMessage()
Creates a new empty message with no values set. |
Method Summary | |
---|---|
IsoValue<?> |
getField(int field)
Returns the IsoValue for the specified field. |
String |
getIsoHeader()
Returns the ISO header that this message was created with. |
Object |
getObjectValue(int field)
Returns the stored value in the field, without converting or formatting it. |
int |
getType()
Returns the ISO message type. |
boolean |
hasField(int idx)
Returns true is the message has a value in the specified field. |
boolean |
isBinary()
Returns true if the message is binary coded; default is false. |
void |
setBinary(boolean flag)
Indicates whether the message should be binary. |
void |
setEtx(int value)
Sets the ETX character, which is sent at the end of the message as a terminator. |
void |
setField(int index,
IsoValue<?> field)
Stored the field in the specified index. |
void |
setIsoHeader(String value)
Sets the string to be sent as ISO header, that is, after the length header but before the message type. |
void |
setType(int value)
Sets the ISO message type. |
void |
setValue(int index,
Object value,
CustomField<Object> encoder,
IsoType t,
int length)
Sets the specified value in the specified field, creating an IsoValue internally. |
void |
setValue(int index,
Object value,
IsoType t,
int length)
Sets the specified value in the specified field, creating an IsoValue internally. |
void |
write(OutputStream outs,
int lengthBytes)
Writes a message to a stream, after writing the specified number of bytes indicating the message's length. |
byte[] |
writeData()
This calls writeInternal(), allowing applications to get the byte buffer containing the message data, without the length header. |
protected byte[] |
writeInternal()
Writes the message to a memory buffer and returns it. |
ByteBuffer |
writeToBuffer(int lengthBytes)
Creates and returns a ByteBuffer with the data of the message, including the length header. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IsoMessage()
Method Detail |
---|
public void setIsoHeader(String value)
public String getIsoHeader()
public void setType(int value)
public int getType()
public void setBinary(boolean flag)
public boolean isBinary()
public void setEtx(int value)
public Object getObjectValue(int field)
field
- The field number. 1 is the secondary bitmap and is not returned as such;
real fields go from 2 to 128.public IsoValue<?> getField(int field)
public void setField(int index, IsoValue<?> field)
public void setValue(int index, Object value, IsoType t, int length)
index
- The field number (2 to 128)value
- The value to be stored.t
- The ISO type.length
- The length of the field, used for ALPHA and NUMERIC values only, ignored
with any other type.public void setValue(int index, Object value, CustomField<Object> encoder, IsoType t, int length)
index
- The field number (2 to 128)value
- The value to be stored.encoder
- An optional CustomField to encode/decode the value.t
- The ISO type.length
- The length of the field, used for ALPHA and NUMERIC values only, ignored
with any other type.public boolean hasField(int idx)
idx
- The field number.public void write(OutputStream outs, int lengthBytes) throws IOException
outs
- The stream to write the message to.lengthBytes
- The size of the message length header. Valid ranges are 0 to 4.
IllegalArgumentException
- if the specified length header is more than 4 bytes.
IOException
- if there is a problem writing to the stream.public ByteBuffer writeToBuffer(int lengthBytes)
public byte[] writeData()
protected byte[] writeInternal()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |