com.streambase.sb

## Class DirectByteArrayView

- java.lang.Object
- - com.streambase.sb.ByteArrayView
  - - com.streambase.sb.DirectByteArrayView

- All Implemented Interfaces:
    CloneableData, Serializable, Cloneable, Comparable<ByteArrayView>

      final class DirectByteArrayView
      extends ByteArrayView

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirectByteArrayView(byte[] data)`
    `DirectByteArrayView(byte[] data, int off, int len)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `array()` Returns a reference to the backing array for this view.
    `ByteArrayView` | `copy()` Create a new ByteArrayView which wraps a new byte[] containing a copy of this view's data NB: this method copies the underlying data
    `ByteArrayView` | `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[]` | `copyBytes()` 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` | `length()` return the length of this view NB: no data is copied when doing this
    `int` | `offset()` return the offset into the backing array of this view NB: no data is copied when doing this
    `ByteArrayView` | `slice(int off, int len)` Create a new ByteArrayView which wraps a portion of this one NB: no data is copied when doing this
    `ByteBuffer` | `view()` Create a new ByteBuffer which wraps all of this one NB: no data is copied when doing this
    `ByteBuffer` | `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 com.streambase.sb.ByteArrayView

      `asString, clone, compareTo, equals, get, hashCode, makeCopiedView, makeCopiedView, makeView, makeView, makeView, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DirectByteArrayView

          public DirectByteArrayView(byte[] data)

    - #### DirectByteArrayView

          public DirectByteArrayView(byte[] data,
                                     int off,
                                     int len)

  - ### Method Detail

    - #### 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:
        `if you need a copy of the data in a byte[] indexed from 0 rather than offset()`

    - #### 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:
        `if you need a copy of the data in a byte[] indexed from 0 rather than offset()`

    - #### 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

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.