Class WrappedByteArray

  • All Implemented Interfaces:

    public class WrappedByteArray
    extends Object
    implements WrappedBytes
    Simple wrapper around a byte[] to provide equals and hashCode semantics
    • Constructor Detail

      • WrappedByteArray

        public WrappedByteArray​(byte[] bytes)
      • WrappedByteArray

        public WrappedByteArray​(byte[] bytes,
                                int hashCode)
    • Method Detail

      • getBytes

        public byte[] getBytes()
        Description copied from interface: WrappedBytes
        The backing array if there is one otherwise null is returned. Callers should use WrappedBytes.backArrayOffset() to know where to read the bytes from. This byte[] should never be modified by the caller
        Specified by:
        getBytes in interface WrappedBytes
        the backing byte[] if there is one.
      • backArrayOffset

        public int backArrayOffset()
        Description copied from interface: WrappedBytes
        The offset of where data starts in the backed array.
        Specified by:
        backArrayOffset in interface WrappedBytes
        -1 if there is no backed array otherwise ≥ 0 if there is backing array
      • getLength

        public int getLength()
        Description copied from interface: WrappedBytes
        The length of the underlying wrapped bytes. This will always be ≥ 0.
        Specified by:
        getLength in interface WrappedBytes
        how many bytes are available from the underlying wrapped implementation
      • getByte

        public byte getByte​(int offset)
        Description copied from interface: WrappedBytes
        Retrieves the byte given an offset. This offset should always be less than WrappedBytes.getLength().
        Specified by:
        getByte in interface WrappedBytes
        offset - the offset of where to find the byte
        the byte at this position
      • equals

        public boolean equals​(Object o)
      • hashCode

        public int hashCode()
      • toString

        public String toString()