Class DirectByteArrayView

java.lang.Object
com.streambase.sb.ByteArrayView
com.streambase.sb.DirectByteArrayView
All Implemented Interfaces:
com.streambase.sb.internal.CloneableData, Serializable, Cloneable, Comparable<ByteArrayView>

final class DirectByteArrayView extends ByteArrayView
Direct byte array view into data
  • Constructor Summary

    Constructors
    Constructor
    Description
    DirectByteArrayView(byte[] data)
    Constructor
    DirectByteArrayView(byte[] data, int off, int len)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Returns a reference to the backing array for this view.
    Create a new ByteArrayView which wraps a new byte[] containing a copy of this view's data NB: this method copies the underlying data
    copy(int off, int len)
    Create a new ByteArrayView which wraps a new byte[] containing a copy of this view's data NB: this method copies the underlying data
    byte[]
    Create a new byte[] containing a copy of this view's data.
    byte[]
    copyBytes(int off, int len)
    Create a new byte[] containing a copy of this view's data within the provided window.
    int
    return the length of this view NB: no data is copied when doing this
    int
    return the offset into the backing array of this view NB: no data is copied when doing this
    slice(int off, int len)
    Create a new ByteArrayView which wraps a portion of this one NB: no data is copied when doing this
    Create a new ByteBuffer which wraps all of this one NB: no data is copied when doing this
    view(int off, int len)
    Create a new ByteBuffer which wraps a portion of this one NB: no data is copied when doing this

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DirectByteArrayView

      public DirectByteArrayView(byte[] data)
      Constructor
      Parameters:
      data - array data
    • DirectByteArrayView

      public DirectByteArrayView(byte[] data, int off, int len)
      Constructor
      Parameters:
      data - array data
      off - offset into data
      len - length of data
  • Method Details

    • slice

      public ByteArrayView slice(int off, int len)
      Description copied from class: ByteArrayView
      Create a new ByteArrayView which wraps a portion of this one NB: no data is copied when doing this
      Specified by:
      slice in class ByteArrayView
      Parameters:
      off - the initial offset of the window (relative to the current window)
      len - the length of the window
      Returns:
      the new ByteArrayView
    • view

      public ByteBuffer view(int off, int len)
      Description copied from class: ByteArrayView
      Create a new ByteBuffer which wraps a portion of this one NB: no data is copied when doing this
      Specified by:
      view in class ByteArrayView
      Parameters:
      off - the initial offset of the window (relative to the current window)
      len - the length of the window
      Returns:
      a ByteBuffer whose arrayOffset() and limit() are the offset and length provided
    • view

      public ByteBuffer view()
      Description copied from class: ByteArrayView
      Create a new ByteBuffer which wraps all of this one NB: no data is copied when doing this
      Specified by:
      view in class ByteArrayView
      Returns:
      a ByteBuffer whose arrayOffset() and limit() are the offset() and length() of this view
    • array

      public byte[] array()
      Description copied from class: ByteArrayView
      Returns a reference to the backing array for this view. Note that the view might only be of a part of the returned array: this means you should only access the array between offsets ByteArrayView.offset() and offset() + ByteArrayView.length(). NB: no data is copied when doing this
      Specified by:
      array in class ByteArrayView
      Returns:
      the backing array
    • offset

      public int offset()
      Description copied from class: ByteArrayView
      return the offset into the backing array of this view NB: no data is copied when doing this
      Specified by:
      offset in class ByteArrayView
      Returns:
      the offset in bytes
    • length

      public int length()
      Description copied from class: ByteArrayView
      return the length of this view NB: no data is copied when doing this
      Specified by:
      length in class ByteArrayView
      Returns:
      the length in bytes
    • copy

      public ByteArrayView copy(int off, int len)
      Description copied from class: ByteArrayView
      Create a new ByteArrayView which wraps a new byte[] containing a copy of this view's data NB: this method copies the underlying data
      Specified by:
      copy in class ByteArrayView
      Parameters:
      off - the initial offset of the window (relative to the current window)
      len - the length of the window
      Returns:
      the new ByteArrayView
      See Also:
    • copy

      public ByteArrayView copy()
      Description copied from class: ByteArrayView
      Create a new ByteArrayView which wraps a new byte[] containing a copy of this view's data NB: this method copies the underlying data
      Specified by:
      copy in class ByteArrayView
      Returns:
      the new ByteArrayView
      See Also:
    • copyBytes

      public byte[] copyBytes(int off, int len)
      Description copied from class: ByteArrayView
      Create a new byte[] containing a copy of this view's data within the provided window. The returned array may be indexed from 0, unlike ByteArrayView.array(). NB: this method copies the underlying data
      Specified by:
      copyBytes in class ByteArrayView
      Parameters:
      off - the initial offset of the window (relative to the current window)
      len - the length of the window
      Returns:
      the new byte[]
    • copyBytes

      public byte[] copyBytes()
      Description copied from class: ByteArrayView
      Create a new byte[] containing a copy of this view's data. The returned array may be indexed from 0, unlike ByteArrayView.array(). NB: this method copies the underlying data
      Specified by:
      copyBytes in class ByteArrayView
      Returns:
      a new byte[] containing a copy of this view's data