Class ByteArray

java.lang.Object
com.aoapps.messaging.ByteArray

public class ByteArray extends Object
Encapsulates a byte[] and the number of bytes used.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final byte[]
     
    static final ByteArray
     
    final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ByteArray(byte[] array)
    Creates a new byte array wrapper.
    ByteArray(byte[] array, int size)
    Creates a new byte array wrapper.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Two ByteArray are equal when they have the same size and each byte within the first size bytes are equal.
    int
    The hashCode is created from the first size bytes.

    Methods inherited from class java.lang.Object

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

    • EMPTY_BYTE_ARRAY

      public static final ByteArray EMPTY_BYTE_ARRAY
    • array

      public final byte[] array
    • size

      public final int size
  • Constructor Details

    • ByteArray

      public ByteArray(byte[] array)
      Creates a new byte array wrapper.
    • ByteArray

      public ByteArray(byte[] array, int size)
      Creates a new byte array wrapper.
  • Method Details

    • equals

      public boolean equals(Object o)
      Two ByteArray are equal when they have the same size and each byte within the first size bytes are equal.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      The hashCode is created from the first size bytes.
      Overrides:
      hashCode in class Object