Package org.jpos.iso

Class RightTPadder

  • All Implemented Interfaces:
    Padder

    public class RightTPadder
    extends RightPadder
    Implements the Padder interface for padding strings and byte arrays on the Right. The difference between this and RightPadder is that this truncates the data during packing, instead of throwing an exception.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static RightTPadder SPACE_PADDER
      A padder for padding spaces on the right.
    • Constructor Summary

      Constructors 
      Constructor Description
      RightTPadder​(char pad)
      Creates a Right Truncating Padder with a specific pad character.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String pad​(java.lang.String data, int maxLength)
      Returns a padded string upto a maximum length.
      • 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 RightTPadder SPACE_PADDER
        A padder for padding spaces on the right. This is very common in alphabetic fields.
    • Constructor Detail

      • RightTPadder

        public RightTPadder​(char pad)
        Creates a Right Truncating 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 java.lang.String pad​(java.lang.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
        Overrides:
        pad in class RightPadder
        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(java.lang.String, int)