Class VipField<M,T>

java.lang.Object
cl.netswitch.iso.vip8583.VipField<M,T>
Type Parameters:
M - the type of the VIP message.
T - the type of the field value.
Direct Known Subclasses:
VipBinF3, VipBinF8, VipBinFH, VipBinFL, VipBinVL, VipNumF10, VipNumF12, VipNumF14, VipNumF16, VipNumF2, VipNumF4, VipNumF6, VipNumF8, VipNumFA4, VipNumFL, VipNumVI, VipNumVL, VipNumVX, VipStrF1, VipStrFL, VipStrVL, VipTk2VL

public abstract class VipField<M,T> extends Object
Definition of a data element of a VIP message.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Charset
    Charset used to convert to/from EBCDIC-037 characters.
    static final byte
    Code of the EBCDIC-037 zero (0) character (0xF0).
    static final byte
    Code of the EBCDIC-037 space (SP) character (0x40).
    static final BigInteger
    BigInteger used to unpack field values (One Hundred).
  • Constructor Summary

    Constructors
    Constructor
    Description
    VipField(int index, String format, int minlen, int maxlen, Class<T> vtype, String name)
    Constructs a new VipField instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    final byte
    chrToEBCDIC(char ch)
    Converts a character to a byte using EBCDIC-037 encoding.
    final T
    decodeAndSetValue(ByteBuffer buffer, M message)
    Decodes the field value from buffer and stores value in message.
    abstract T
    Decodes the value of this field from the supplied byte buffer.
    abstract void
    encodeValue(T value, cl.netswitch.lib.util.ByteArray barray)
    Encodes the value of this field into the supplied byte array.
    final String
    Returns a string used to build exception related to this field.
    final String
    Returns the name of the format of this field.
    final int
    Returns the index of this Field.
    final int
    Returns the maximum length of this field.
    final int
    Returns the minimum length of this field.
    final String
    Returns the name of this field.
    Returns the obfuscate option of this field.
    final Class<T>
    Returns the type of the value of this field.
    final T
    getValue(M message)
    Returns the value of this field from the supplied message.
    final T
    getValueAndEncode(M message, cl.netswitch.lib.util.ByteArray barray)
    Gets the field value from message and encodes into supplied byte array.
    final char
    Returns the EBCDIC-037 character contained in supplied buffer.
    final byte
    Returns a byte with the value of a numeric digit.
    readFieldBuffer(ByteBuffer buffer, int length)
    Returns a ByteBuffer with the bytes of the specified length.
    Returns a ByteBuffer with the bytes specified by 1-byte length header.
    Returns a ByteBuffer with the bytes specified by 2-byte length header.
    final int
    Returns the value of the 1-byte length header of this field.
    final int
    Returns the value of the 2-byte length header of this field.
    final long
    Returns a long with the value of a 10 packed digit number.
    final long
    Returns a long with the value of a 12 packed digit number.
    final long
    Returns a long with the value of a 14 packed digit number.
    final long
    Returns a long with the value of a 16 packed digit number.
    final byte
    Returns a byte with the value of a 2 packed digit number.
    final short
    Returns a short with the value of a 4 packed digit number.
    final int
    Returns an integer with the value of a 6 packed digit number.
    final int
    Returns an integer with the value of a 8 packed digit number.
    final long
    readNumberVL(ByteBuffer buffer, int length)
    Returns a long value with specified number of BCD packed bytes.
    final int
    Returns the number of packed bytes of the value of this field.
    final String
    readString(ByteBuffer buffer, int length, boolean rtrim)
    Returns an EBCDIC-037 string of specified length.
    int
    Returns the LENGTH of a TLV element in supplied buffer.
    int
    Returns the TAG of a TLV element in supplied buffer.
    final String
    Returns the supplied string with trailing spaces removed.
    final void
    Changes the obfuscate option of this field.
    final void
    setValue(M message, T value)
    Changes the value of this field in the supplied message.
    final String
    Converts a byte array to a string using EBCDIC-037 encoding.
    final byte[]
    Converts a string to a byte array using EBCDIC-037 encoding.
    final void
    writeChar(char ch, cl.netswitch.lib.util.ByteArray barray)
    Writes an EBCDIC-037 character in supplied byte array.
    final void
    writeMessageValue(M message, VipWriter<M> writer)
    Writes the field value contained in message using writer.
    final int
    writeNumber10(long value, cl.netswitch.lib.util.ByteArray barray)
    Writes 10 packed digits of supplied long value to a byte array.
    final int
    writeNumber12(long value, cl.netswitch.lib.util.ByteArray barray)
    Writes 12 packed digits of supplied long value to a byte array.
    final int
    writeNumber14(long value, cl.netswitch.lib.util.ByteArray barray)
    Writes 14 packed digits of supplied long value to a byte array.
    final int
    writeNumber16(long value, cl.netswitch.lib.util.ByteArray barray)
    Writes 16 packed digits of supplied long value to a byte array.
    final int
    writeNumber2(byte value, cl.netswitch.lib.util.ByteArray barray)
    Writes 2 packed digits of supplied byte value to a byte array.
    final int
    writeNumber4(short value, cl.netswitch.lib.util.ByteArray barray)
    Writes 4 packed digits of supplied short value to a byte array.
    final int
    writeNumber6(int value, cl.netswitch.lib.util.ByteArray barray)
    Writes 6 packed digits of supplied integer value to a byte array.
    final int
    writeNumber8(int value, cl.netswitch.lib.util.ByteArray barray)
    Writes 8 packed digits of supplied integer value to a byte array.
    final byte[]
    writeNumberVL(long value)
    Returns a byte array with the packed BCD digits of supplied value.
    final void
    writeString(char fill, String value, int length, cl.netswitch.lib.util.ByteArray barray)
    Writes a right-justified fixed-length EBCDIC-037 string to a byte array.
    final void
    writeString(String value, int length, char fill, cl.netswitch.lib.util.ByteArray barray)
    Writes a left-justified fixed-length EBCDIC-037 string to a byte array.
    void
    writeTlvLength(int length, cl.netswitch.lib.util.ByteArray barray)
    Writes the LENGTH of a TLV element in supplied byte array.
    void
    writeTlvTag(int tag, cl.netswitch.lib.util.ByteArray barray)
    Writes the TAG of a TLV element in supplied byte array.
    protected void
    writeValue(T value, VipWriter<M> writer)
    Writes the supplied field value using the specified writer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ONE100

      public static final BigInteger ONE100
      BigInteger used to unpack field values (One Hundred).
    • EBCDIC

      public static final Charset EBCDIC
      Charset used to convert to/from EBCDIC-037 characters.
    • EBCDIC_SPACE

      public static final byte EBCDIC_SPACE
      Code of the EBCDIC-037 space (SP) character (0x40).
      See Also:
    • EBCDIC_DIGIT0

      public static final byte EBCDIC_DIGIT0
      Code of the EBCDIC-037 zero (0) character (0xF0).
      See Also:
  • Constructor Details

    • VipField

      public VipField(int index, String format, int minlen, int maxlen, Class<T> vtype, String name)
      Constructs a new VipField instance.
      Parameters:
      index - the index of this field.
      format - the format of this field.
      minlen - min number of elements of this field value.
      maxlen - max number of elements of this field value.
      vtype - the class type of the this field value.
      name - the name of this field.
      Throws:
      NullPointerException - if an argument is null.
      IllegalArgumentException - if an argument is invalid.
  • Method Details

    • getIndex

      public final int getIndex()
      Returns the index of this Field.
      Returns:
      the index of this Field.
    • getFormat

      public final String getFormat()
      Returns the name of the format of this field.
      Returns:
      the name of the format of this field.
    • getMinLength

      public final int getMinLength()
      Returns the minimum length of this field.
      Returns:
      the minimum length of this field.
    • getMaxLength

      public final int getMaxLength()
      Returns the maximum length of this field.
      Returns:
      the maximum length of this field.
    • getName

      public final String getName()
      Returns the name of this field.
      Returns:
      the name of this field.
    • getType

      public final Class<T> getType()
      Returns the type of the value of this field.
      Returns:
      the type of the value of this field.
    • getObfuscate

      public final VipObfuscate getObfuscate()
      Returns the obfuscate option of this field.
      Returns:
      the obfuscate option of this field.
    • setObfuscate

      public final void setObfuscate(VipObfuscate obfuscate)
      Changes the obfuscate option of this field.
      Parameters:
      obfuscate - the new obfuscate option.
      Throws:
      NullPointerException - if obfuscate is null.
    • decodeAndSetValue

      public final T decodeAndSetValue(ByteBuffer buffer, M message)
      Decodes the field value from buffer and stores value in message.
      Parameters:
      buffer - the buffer containing the encoded field value.
      message - the message where the field value is stored.
      Returns:
      the non-null field value decoded from buffer.
      Throws:
      NullPointerException - if an argument is null.
      VipException - if contents of buffer is invalid.
    • setValue

      public final void setValue(M message, T value)
      Changes the value of this field in the supplied message.
      Parameters:
      message - the message to be modified.
      value - the new value of this field (can be null).
      Throws:
      NullPointerException - if message is null.
      IllegalArgumentException - if value is invalid.
      VipException - if another error occurs changing the value.
    • decodeValue

      public abstract T decodeValue(ByteBuffer buffer)
      Decodes the value of this field from the supplied byte buffer.
      Parameters:
      buffer - the buffer containing the encoded field value.
      Returns:
      the value decoded from supplied byte buffer.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • getValueAndEncode

      public final T getValueAndEncode(M message, cl.netswitch.lib.util.ByteArray barray)
      Gets the field value from message and encodes into supplied byte array.
      Parameters:
      message - the object that contains the field value.
      barray - the byte array containing encoded field values.
      Returns:
      the field value that was encoded into the byte array.
      Throws:
      NullPointerException - if an argument is null.
      ClassCastException - if the field value is of wrong type.
      VipException - if the field value in message is invalid.
    • getValue

      public final T getValue(M message)
      Returns the value of this field from the supplied message.
      Parameters:
      message - the object to be modified.
      Returns:
      the value of this field read from supplied message.
      Throws:
      NullPointerException - if message is null.
      ClassCastException - if the returned value is invalid.
      VipException - if another error occurs getting the value.
    • encodeValue

      public abstract void encodeValue(T value, cl.netswitch.lib.util.ByteArray barray)
      Encodes the value of this field into the supplied byte array.
      Parameters:
      value - the field value to be encoded into byte array.
      barray - the byte array containing encoded field values.
      Throws:
      NullPointerException - if an argument is null.
      VipException - if value is invalid.
    • writeMessageValue

      public final void writeMessageValue(M message, VipWriter<M> writer)
      Writes the field value contained in message using writer.
      Parameters:
      message - the message that contains the field value.
      writer - the writer used to write the field value.
      Throws:
      NullPointerException - if an argument is null.
      ClassCastException - if type of field value is invalid.
      VipException - if another error occurs.
    • writeValue

      protected void writeValue(T value, VipWriter<M> writer)
      Writes the supplied field value using the specified writer.
      Parameters:
      value - the field value to write with writer.
      writer - the writer used to write the field value.
      Throws:
      NullPointerException - if an argument is null.
      VipException - if another error occurs.
    • fieldError

      public final String fieldError(String error)
      Returns a string used to build exception related to this field.
      Parameters:
      error - a description of the error condition found.
      Returns:
      a string used to build errors related to this field.
    • rightTrim

      public final String rightTrim(String str)
      Returns the supplied string with trailing spaces removed.
      Parameters:
      str - the string to be inspected.
      Returns:
      the supplied string with trailing spaces removed.
      Throws:
      NullPointerException - if str is null.
    • readPackedLength

      public final int readPackedLength(ByteBuffer buffer)
      Returns the number of packed bytes of the value of this field.
      Parameters:
      buffer - the buffer that contains the length and the value.
      Returns:
      the number of packed bytes of the value of this field.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if the number of packed bytes is out-of-range.
      BufferUnderflowException - if buffer is missing bytes.
    • readLengthHeader1

      public final int readLengthHeader1(ByteBuffer buffer)
      Returns the value of the 1-byte length header of this field.
      Parameters:
      buffer - the buffer that contains the 1-byte length header.
      Returns:
      the value of the 1-byte length header of this field.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • readLengthHeader2

      public final int readLengthHeader2(ByteBuffer buffer)
      Returns the value of the 2-byte length header of this field.
      Parameters:
      buffer - the buffer that contains the 2-byte length header.
      Returns:
      the value of the 2-byte length header of this field.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • readFieldBuffer

      public final ByteBuffer readFieldBuffer(ByteBuffer buffer, int length)
      Returns a ByteBuffer with the bytes of the specified length.
      Parameters:
      buffer - the buffer containing the variable-length field value.
      length - the number of bytes to read in buffer.
      Returns:
      a ByteBuffer with the byte array of the specified length.
      Throws:
      NullPointerException - if buffer is null.
      IllegalArgumentException - if length is negative.
      BufferUnderflowException - if buffer is missing bytes.
    • readFieldBuffer1

      public final ByteBuffer readFieldBuffer1(ByteBuffer buffer)
      Returns a ByteBuffer with the bytes specified by 1-byte length header.
      Parameters:
      buffer - the buffer containing the variable-length field value.
      Returns:
      a ByteBuffer with the bytes specified by 1-byte length header.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • readFieldBuffer2

      public final ByteBuffer readFieldBuffer2(ByteBuffer buffer)
      Returns a ByteBuffer with the bytes specified by 2-byte length header.
      Parameters:
      buffer - the buffer containing the variable-length field value.
      Returns:
      a ByteBuffer with the bytes specified by 2-byte length header.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • readDigit

      public final byte readDigit(ByteBuffer buffer)
      Returns a byte with the value of a numeric digit.
      Parameters:
      buffer - the buffer containing the digit.
      Returns:
      a byte with the value of a numeric digit.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • readNumber2

      public final byte readNumber2(ByteBuffer buffer)
      Returns a byte with the value of a 2 packed digit number.
      Parameters:
      buffer - the buffer containing packed digits.
      Returns:
      a byte with the value of a 2 digit number.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • writeNumber2

      public final int writeNumber2(byte value, cl.netswitch.lib.util.ByteArray barray)
      Writes 2 packed digits of supplied byte value to a byte array.
      Parameters:
      value - the byte value to be written to barray.
      barray - the byte array where the packed digits are written.
      Returns:
      the absolute index where the packed digits were written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if value is out-of-range.
    • readNumber4

      public final short readNumber4(ByteBuffer buffer)
      Returns a short with the value of a 4 packed digit number.
      Parameters:
      buffer - the buffer containing packed digits.
      Returns:
      a short with the value of a 4 packed digit number.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • writeNumber4

      public final int writeNumber4(short value, cl.netswitch.lib.util.ByteArray barray)
      Writes 4 packed digits of supplied short value to a byte array.
      Parameters:
      value - the short value to be written to barray.
      barray - the byte array where the packed digits are written.
      Returns:
      the absolute index where the packed digits were written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if value is out-of-range.
    • readNumber6

      public final int readNumber6(ByteBuffer buffer)
      Returns an integer with the value of a 6 packed digit number.
      Parameters:
      buffer - the buffer containing packed digits.
      Returns:
      an integer with the value of a 6 packed digit number.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • writeNumber6

      public final int writeNumber6(int value, cl.netswitch.lib.util.ByteArray barray)
      Writes 6 packed digits of supplied integer value to a byte array.
      Parameters:
      value - the integer value to be written to barray.
      barray - the byte array where the packed digits are written.
      Returns:
      the absolute index where the packed digits were written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if value is out-of-range.
    • readNumber8

      public final int readNumber8(ByteBuffer buffer)
      Returns an integer with the value of a 8 packed digit number.
      Parameters:
      buffer - the buffer containing packed digits.
      Returns:
      an integer with the value of a 8 packed digit number.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • writeNumber8

      public final int writeNumber8(int value, cl.netswitch.lib.util.ByteArray barray)
      Writes 8 packed digits of supplied integer value to a byte array.
      Parameters:
      value - the integer value to be written to barray.
      barray - the byte array where the packed digits are written.
      Returns:
      the absolute index where the packed digits were written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if value is out-of-range.
    • readNumber10

      public final long readNumber10(ByteBuffer buffer)
      Returns a long with the value of a 10 packed digit number.
      Parameters:
      buffer - the buffer containing packed digits.
      Returns:
      a long with the value of a 10 packed digit number.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • writeNumber10

      public final int writeNumber10(long value, cl.netswitch.lib.util.ByteArray barray)
      Writes 10 packed digits of supplied long value to a byte array.
      Parameters:
      value - the long value to be written to barray.
      barray - the byte array where the packed digits are written.
      Returns:
      the absolute index where the packed digits were written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if value is out-of-range.
    • readNumber12

      public final long readNumber12(ByteBuffer buffer)
      Returns a long with the value of a 12 packed digit number.
      Parameters:
      buffer - the buffer containing packed digits.
      Returns:
      a long with the value of a 12 packed digit number.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • writeNumber12

      public final int writeNumber12(long value, cl.netswitch.lib.util.ByteArray barray)
      Writes 12 packed digits of supplied long value to a byte array.
      Parameters:
      value - the long value to be written to barray.
      barray - the byte array where the packed digits are written.
      Returns:
      the absolute index where the packed digits were written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if value is out-of-range.
    • readNumber14

      public final long readNumber14(ByteBuffer buffer)
      Returns a long with the value of a 14 packed digit number.
      Parameters:
      buffer - the buffer containing packed digits.
      Returns:
      a long with the value of a 14 packed digit number.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • writeNumber14

      public final int writeNumber14(long value, cl.netswitch.lib.util.ByteArray barray)
      Writes 14 packed digits of supplied long value to a byte array.
      Parameters:
      value - the long value to be written to barray.
      barray - the byte array where the packed digits are written.
      Returns:
      the absolute index where the packed digits were written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if value is out-of-range.
    • readNumber16

      public final long readNumber16(ByteBuffer buffer)
      Returns a long with the value of a 16 packed digit number.
      Parameters:
      buffer - the buffer containing packed digits.
      Returns:
      a long with the value of a 16 packed digit number.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • writeNumber16

      public final int writeNumber16(long value, cl.netswitch.lib.util.ByteArray barray)
      Writes 16 packed digits of supplied long value to a byte array.
      Parameters:
      value - the long value to be written to barray.
      barray - the byte array where the packed digits are written.
      Returns:
      the absolute index where the packed digits were written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if value is out-of-range.
    • readNumberVL

      public final long readNumberVL(ByteBuffer buffer, int length)
      Returns a long value with specified number of BCD packed bytes.
      Parameters:
      buffer - the buffer containing packed digits.
      length - the number of BCD packed bytes to read.
      Returns:
      a long value with specified number of BCD packed bytes.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if length or buffer are invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • writeNumberVL

      public final byte[] writeNumberVL(long value)
      Returns a byte array with the packed BCD digits of supplied value.
      Parameters:
      value - the value to be converted to packed BCD byte array.
      Returns:
      a byte array with the packed BCD digits of value.
      Throws:
      VipException - if supplied value is negative.
    • strFromEBCDIC

      public final String strFromEBCDIC(ByteBuffer buffer)
      Converts a byte array to a string using EBCDIC-037 encoding.
      Parameters:
      buffer - the byte buffer to be converted.
      Returns:
      a string created using supplied EBCDIC-037 byte buffer.
      Throws:
      NullPointerException - if buffer is null.
    • strToEBCDIC

      public final byte[] strToEBCDIC(String str)
      Converts a string to a byte array using EBCDIC-037 encoding.
      Parameters:
      str - the string to be converted.
      Returns:
      the EBCDIC-037 byte array obtain from supplied string.
      Throws:
      NullPointerException - if str is null.
    • chrToEBCDIC

      public final byte chrToEBCDIC(char ch)
      Converts a character to a byte using EBCDIC-037 encoding.
      Parameters:
      ch - the character to be converted.
      Returns:
      the a character to a byte using EBCDIC-037 encoding.
    • readChar

      public final char readChar(ByteBuffer buffer)
      Returns the EBCDIC-037 character contained in supplied buffer.
      Parameters:
      buffer - the buffer containing the EBCDIC-037 character.
      Returns:
      the EBCDIC-037 character contained in supplied buffer.
      Throws:
      NullPointerException - if buffer is null.
      BufferUnderflowException - if buffer is missing bytes.
    • writeChar

      public final void writeChar(char ch, cl.netswitch.lib.util.ByteArray barray)
      Writes an EBCDIC-037 character in supplied byte array.
      Parameters:
      ch - the EBCDIC-037 character to write in barray.
      barray - the byte array where the character is written.
      Throws:
      NullPointerException - if barray is null.
    • readString

      public final String readString(ByteBuffer buffer, int length, boolean rtrim)
      Returns an EBCDIC-037 string of specified length.
      Parameters:
      buffer - the buffer containing the EBCDIC-037 string.
      length - the number of character of the EBCDIC-037 string.
      rtrim - if true trailing spaces are removed.
      Returns:
      an EBCDIC-037 string of specified length.
      Throws:
      NullPointerException - if buffer is null.
      IllegalArgumentException - if length is negative.
      BufferUnderflowException - if buffer is missing bytes.
    • writeString

      public final void writeString(String value, int length, char fill, cl.netswitch.lib.util.ByteArray barray)
      Writes a left-justified fixed-length EBCDIC-037 string to a byte array.
      Parameters:
      value - the string to convert and write in barray (can be null).
      length - the number of characters to write with padding.
      fill - the character used to right-fill to complete length.
      barray - the byte array where the resulting bytes are written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if string value is too long.
    • writeString

      public final void writeString(char fill, String value, int length, cl.netswitch.lib.util.ByteArray barray)
      Writes a right-justified fixed-length EBCDIC-037 string to a byte array.
      Parameters:
      fill - the character used to left-fill to complete length.
      value - the string to be written to barray (can be null).
      length - the length of the fixed-length of the string.
      barray - the byte array where the string is written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if string value is too long.
    • readTlvTag

      public int readTlvTag(ByteBuffer buffer)
      Returns the TAG of a TLV element in supplied buffer.
      Parameters:
      buffer - the buffer containing the TLV element.
      Returns:
      the TAG of a TLV element in supplied buffer.
      Throws:
      NullPointerException - if buffer is null.
      BufferUnderflowException - if buffer is missing bytes.
    • writeTlvTag

      public void writeTlvTag(int tag, cl.netswitch.lib.util.ByteArray barray)
      Writes the TAG of a TLV element in supplied byte array.
      Parameters:
      tag - the TAG of a TLV element to write in barray.
      barray - the byte array where the TAG is written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if tag is negative or too large.
    • readTlvLength

      public int readTlvLength(ByteBuffer buffer)
      Returns the LENGTH of a TLV element in supplied buffer.
      Parameters:
      buffer - the buffer containing the TLV element.
      Returns:
      the LENGTH of a TLV element in supplied buffer.
      Throws:
      NullPointerException - if buffer is null.
      VipException - if contents of buffer is invalid.
      BufferUnderflowException - if buffer is missing bytes.
    • writeTlvLength

      public void writeTlvLength(int length, cl.netswitch.lib.util.ByteArray barray)
      Writes the LENGTH of a TLV element in supplied byte array.
      Parameters:
      length - the LENGTH of a TLV element to write in barray.
      barray - the byte array where the LENGTH is written.
      Throws:
      NullPointerException - if barray is null.
      VipException - if length is negative or too large.