Class LeftPadder

java.lang.Object
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.
  • Field Details

    • ZERO_PADDER

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

    • 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 Details

    • 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
    • unpad

      public String unpad(String paddedData)
      (non-Javadoc)
      Specified by:
      unpad in interface Padder
      Parameters:
      paddedData - The string to unpad.
      Returns:
      The unpadded string.