Interface BinaryInterpreter

All Known Implementing Classes:
AsciiHexInterpreter, EbcdicBinaryInterpreter, EbcdicHexInterpreter, LiteralBinaryInterpreter

public interface BinaryInterpreter
This interface supports the encoding and decoding of binary data. Common implementations are literal or no conversion, ASCII Hex, EBCDIC Hex and BCD.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getPackedLength(int nBytes)
    Returns the number of bytes required to interpret a byte array of length nBytes.
    void
    interpret(byte[] data, byte[] b, int offset)
    Converts the binary data into a different interpretation or coding.
    byte[]
    uninterpret(byte[] rawData, int offset, int length)
    Converts the raw byte array into a uninterpreted byte array.
  • Method Details

    • interpret

      void interpret(byte[] data, byte[] b, int offset)
      Converts the binary data into a different interpretation or coding. Standard interpretations are ASCII Hex, EBCDIC Hex, BCD and LITERAL.
      Parameters:
      data - The data to be interpreted.
      b - The byte array to write the interpreted data to.
      offset - The starting position in b.
    • uninterpret

      byte[] uninterpret(byte[] rawData, int offset, int length)
      Converts the raw byte array into a uninterpreted byte array. This reverses the interpret method.
      Parameters:
      rawData - The interpreted data.
      offset - The index in rawData to start uninterpreting at.
      length - The number of uninterpreted bytes to uninterpret. This number may be different from the number of raw bytes that are uninterpreted.
      Returns:
      The uninterpreted data.
    • getPackedLength

      int getPackedLength(int nBytes)
      Returns the number of bytes required to interpret a byte array of length nBytes.