org.jpos.iso
Class LeftPadder

java.lang.Object
  extended by org.jpos.iso.LeftPadder
All Implemented Interfaces:
Padder

public class LeftPadder
extends Object
implements Padder

Implements the Padder interface for padding strings and byte arrays on the left.

Version:
$Revision$ $Date$
Author:
joconnor

Field Summary
static LeftPadder ZERO_PADDER
          A padder for padding zeros on the left.
 
Constructor Summary
LeftPadder(char pad)
          Creates a Left Padder with a specific pad character.
 
Method Summary
 String pad(String data, int maxLength)
          Returns a padded string upto a maximum length.
 String unpad(String paddedData)
          (non-Javadoc)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO_PADDER

public static final LeftPadder ZERO_PADDER
A padder for padding zeros on the left. This is very common in numeric fields.

Constructor Detail

LeftPadder

public LeftPadder(char pad)
Creates a Left Padder with a specific pad character.

Parameters:
pad - The padding character. For binary padders, the pad character is truncated to lower order byte.
Method Detail

pad

public String pad(String data,
                  int maxLength)
           throws ISOException
Description copied from interface: Padder
Returns a padded string upto a maximum length. If the data is longer than maxLength, then the data is truncated.

Specified by:
pad in interface Padder
Parameters:
data - The string to pad.
maxLength - The maximum length of the padded string.
Returns:
A padded string.
Throws:
ISOException - on error
See Also:
org.jpos.iso.Padder#pad(java.lang.String, int, char)

unpad

public String unpad(String paddedData)
(non-Javadoc)

Specified by:
unpad in interface Padder
Parameters:
paddedData - The string to unpad.
Returns:
The unpadded string.
See Also:
org.jpos.iso.Padder#unpad(java.lang.String, char)


Copyright © 1998-2012 jPOS.org. All Rights Reserved.