java.lang.Object
net.metanotion.io.data.IdentityBytes
All Implemented Interfaces:
Serializer<byte[]>

public class IdentityBytesextends Object implements Serializer<byte[]>
Pass-through serializer for byte arrays.

Returns byte arrays unchanged during serialization/deserialization. Useful for storing raw binary data without modification.

Important: Performs direct reference copy, not deep copy. Modifications to returned array affect the original array.

  • Constructor Details

    • IdentityBytes

      public IdentityBytes()
      Constructor. The pass-through holds no state: both methods hand back the very array they are given.
  • Method Details

    • getBytes

      public byte[] getBytes(byte[] o)
      Return the bytes unchanged.
      Specified by:
      getBytes in interface Serializer<byte[]>
      Parameters:
      o - the object to serialize
      Returns:
      byte[]
    • construct

      public byte[] construct(byte[] b)
      Return the bytes unchanged.
      Specified by:
      construct in interface Serializer<byte[]>
      Parameters:
      b - the serialized bytes to read back
      Returns:
      b