Interface FixedField

All Known Implementing Classes:
ByteField, IntegerField, LongField, ShortField

public interface FixedField
behavior of a field at a fixed location within a byte array
Author:
Marc Johnson (mjohnson at apache dot org
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    readFromBytes(byte[] data)
    set the value from its offset into an array of bytes
    void
    set the value from an InputStream
    return the value as a String
    void
    writeToBytes(byte[] data)
    write the value out to an array of bytes at the appropriate offset
  • Method Details

    • readFromBytes

      void readFromBytes(byte[] data) throws ArrayIndexOutOfBoundsException
      set the value from its offset into an array of bytes
      Parameters:
      data - the byte array from which the value is to be read
      Throws:
      ArrayIndexOutOfBoundsException - if the offset is out of the array's valid index range
    • readFromStream

      void readFromStream(InputStream stream) throws IOException
      set the value from an InputStream
      Parameters:
      stream - the InputStream from which the value is to be read
      Throws:
      LittleEndian.BufferUnderrunException - if there is not enough data available from the InputStream
      IOException - if an IOException is thrown from reading the InputStream
    • writeToBytes

      void writeToBytes(byte[] data) throws ArrayIndexOutOfBoundsException
      write the value out to an array of bytes at the appropriate offset
      Parameters:
      data - the array of bytes to which the value is to be written
      Throws:
      ArrayIndexOutOfBoundsException - if the offset is out of the array's valid index range
    • toString

      String toString()
      return the value as a String
      Overrides:
      toString in class Object
      Returns:
      the value as a String