jPOS 1.6.1 API Documentation

org.jpos.iso
Class ISOAmountFieldPackager

java.lang.Object
  extended by org.jpos.iso.ISOFieldPackager
      extended by org.jpos.iso.ISOAmountFieldPackager
Direct Known Subclasses:
IFA_AMOUNT, IFE_AMOUNT

public class ISOAmountFieldPackager
extends ISOFieldPackager

Version:
$Revision: 2594 $ $Date: 2008-01-22 08:41:31 -0800 (Tue, 22 Jan 2008) $
Author:
joconnor

Constructor Summary
ISOAmountFieldPackager()
          Constructs a default ISOAmountFieldPackager.
ISOAmountFieldPackager(int maxLength, java.lang.String description, Padder padder, Interpreter interpreter, Prefixer prefixer)
          Creates an ISOAmountFieldPackager.
ISOAmountFieldPackager(Padder padder, Interpreter interpreter, Prefixer prefixer)
          Constructs an ISOAmountFieldPackager with a specific Padder, Interpreter and Prefixer.
 
Method Summary
 int getMaxPackedLength()
          Returns the prefixer's packed length and the interpreter's packed length.
 byte[] pack(ISOComponent c)
          Packs the component into a byte[].
 void setInterpreter(Interpreter 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.
 
Methods inherited from class org.jpos.iso.ISOFieldPackager
createComponent, getDescription, getLength, pack, setDescription, setLength, setPad
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ISOAmountFieldPackager

public ISOAmountFieldPackager(int maxLength,
                              java.lang.String description,
                              Padder padder,
                              Interpreter interpreter,
                              Prefixer prefixer)
Creates an ISOAmountFieldPackager.

Parameters:
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.
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.

ISOAmountFieldPackager

public ISOAmountFieldPackager()
Constructs a default ISOAmountFieldPackager. There is no padding, no length prefix and a literal interpretation. The set methods must be called to make this ISOAmountFieldPackager useful.


ISOAmountFieldPackager

public ISOAmountFieldPackager(Padder padder,
                              Interpreter interpreter,
                              Prefixer prefixer)
Constructs an ISOAmountFieldPackager with a specific Padder, Interpreter and Prefixer. The length and description should be set with setLength() and setDescription methods.

Parameters:
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.
Method Detail

setPadder

public void setPadder(Padder padder)
Sets the Padder.

Parameters:
padder - The padder to use during packing and unpacking.

setInterpreter

public void setInterpreter(Interpreter interpreter)
Sets the Interpreter.

Parameters:
interpreter - The interpreter to use in packing and unpacking.

setPrefixer

public void setPrefixer(Prefixer prefixer)
Sets the length prefixer.

Parameters:
prefixer - The length prefixer to use during packing and unpacking.

getMaxPackedLength

public int getMaxPackedLength()
Returns the prefixer's packed length and the interpreter's packed length.

Specified by:
getMaxPackedLength in class ISOFieldPackager
See Also:
ISOFieldPackager.getMaxPackedLength()

pack

public byte[] pack(ISOComponent c)
            throws ISOException
Packs the component into a byte[].

Specified by:
pack in class ISOFieldPackager
Parameters:
c - - a component
Returns:
packed component
Throws:
ISOException

unpack

public int unpack(ISOComponent c,
                  byte[] b,
                  int offset)
           throws ISOException
Unpacks the byte array into the component.

Specified by:
unpack in class ISOFieldPackager
Parameters:
c - The component to unpack into.
b - The byte array to unpack.
offset - The index in the byte array to start unpacking from.
Returns:
The number of bytes consumed unpacking the component.
Throws:
ISOException

unpack

public void unpack(ISOComponent c,
                   java.io.InputStream in)
            throws java.io.IOException,
                   ISOException
Unpack the input stream into the component.

Overrides:
unpack in class ISOFieldPackager
Parameters:
c - The Component to unpack into.
in - Input stream where the packed bytes come from.
Throws:
java.io.IOException - Thrown if there's a problem reading the input stream.
ISOException

jPOS.org