Interface WrappedBytes

All Known Implementing Classes:
WrappedByteArray

public interface WrappedBytes
Interface that describes and object holding onto some bytes
Since:
9.0
Author:
wburns
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    The offset of where data starts in the backed array.
    default boolean
     
    byte
    getByte(int offset)
    Retrieves the byte given an offset.
    byte[]
    The backing array if there is one otherwise null is returned.
    int
    The length of the underlying wrapped bytes.
  • Method Details

    • getBytes

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

      int backArrayOffset()
      The offset of where data starts in the backed array.
      Returns:
      -1 if there is no backed array otherwise ≥ 0 if there is backing array
    • getLength

      int getLength()
      The length of the underlying wrapped bytes. This will always be ≥ 0.
      Returns:
      how many bytes are available from the underlying wrapped implementation
    • getByte

      byte getByte(int offset)
      Retrieves the byte given an offset. This offset should always be less than getLength().
      Parameters:
      offset - the offset of where to find the byte
      Returns:
      the byte at this position
    • equalsWrappedBytes

      default boolean equalsWrappedBytes(WrappedBytes other)