org.jpos.iso
Class RightPadder

java.lang.Object
  extended by org.jpos.iso.RightPadder
All Implemented Interfaces:
Padder
Direct Known Subclasses:
RightTPadder

public class RightPadder
extends Object
implements Padder

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

Version:
$Revision$ $Date$
Author:
joconnor

Field Summary
static RightPadder SPACE_PADDER
          A padder for padding spaces on the right.
 
Constructor Summary
RightPadder(char pad)
          Creates a Right 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)
          Removes the padding from a padded string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPACE_PADDER

public static final RightPadder SPACE_PADDER
A padder for padding spaces on the right. This is very common in alphabetic fields.

Constructor Detail

RightPadder

public RightPadder(char pad)
Creates a Right 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:
Padder.pad(String, int)

unpad

public String unpad(String paddedData)
Description copied from interface: Padder
Removes the padding from a padded string.

Specified by:
unpad in interface Padder
Parameters:
paddedData - The string to unpad.
Returns:
The unpadded string.
See Also:
Padder.unpad(String)


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