java.lang.Object
net.metanotion.io.data.IntBytes
All Implemented Interfaces:
Serializer<Integer>

public class IntBytesextends Object implements Serializer<Integer>
Integer serializer using 4-byte big-endian representation.

Converts between Integer objects and 4-byte big-endian arrays. Provides consistent byte ordering for cross-platform compatibility.

Serialization format:

  • Byte 0: Most significant byte (bits 24-31)
  • Byte 1: Second most significant byte (bits 16-23)
  • Byte 2: Third most significant byte (bits 8-15)
  • Byte 3: Least significant byte (bits 0-7)
  • Constructor Details

    • IntBytes

      public IntBytes()
      Constructor. The conversion is a pure function of the value or the four bytes handed to it, so an instance carries no state.
  • Method Details

    • getBytes

      public byte[] getBytes(Integer o)
      Description copied from interface: Serializer
      o).
      Specified by:
      getBytes in interface Serializer<Integer>
      Parameters:
      o - the object to serialize
      Returns:
      the given object's serialized form as a byte array
    • construct

      public Integer construct(byte[] b)
      Description copied from interface: Serializer
      b).
      Specified by:
      construct in interface Serializer<Integer>
      Parameters:
      b - the serialized bytes to read back
      Returns:
      the deserialized object