Package com.streambase.sb
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>
Direct byte array view into data
-
Constructor Summary
ConstructorsConstructorDescriptionDirectByteArrayView(byte[] data) ConstructorDirectByteArrayView(byte[] data, int off, int len) Constructor -
Method Summary
Modifier and TypeMethodDescriptionbyte[]array()Returns a reference to the backing array for this view.copy()Create a new ByteArrayView which wraps a new byte[] containing a copy of this view's data NB: this method copies the underlying datacopy(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 databyte[]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.intlength()return the length of this view NB: no data is copied when doing thisintoffset()return the offset into the backing array of this view NB: no data is copied when doing thisslice(int off, int len) Create a new ByteArrayView which wraps a portion of this one NB: no data is copied when doing thisview()Create a new ByteBuffer which wraps all of this one NB: no data is copied when doing thisview(int off, int len) Create a new ByteBuffer which wraps a portion of this one NB: no data is copied when doing thisMethods inherited from class com.streambase.sb.ByteArrayView
asString, clone, compareTo, equals, get, hashCode, makeCopiedView, makeCopiedView, makeView, makeView, makeView, toString
-
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 dataoff- offset into datalen- length of data
-
-
Method Details
-
slice
Description copied from class:ByteArrayViewCreate a new ByteArrayView which wraps a portion of this one NB: no data is copied when doing this- Specified by:
slicein classByteArrayView- Parameters:
off- the initial offset of the window (relative to the current window)len- the length of the window- Returns:
- the new ByteArrayView
-
view
Description copied from class:ByteArrayViewCreate a new ByteBuffer which wraps a portion of this one NB: no data is copied when doing this- Specified by:
viewin classByteArrayView- 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
Description copied from class:ByteArrayViewCreate a new ByteBuffer which wraps all of this one NB: no data is copied when doing this- Specified by:
viewin classByteArrayView- Returns:
- a ByteBuffer whose arrayOffset() and limit() are the offset() and length() of this view
-
array
public byte[] array()Description copied from class:ByteArrayViewReturns 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 offsetsByteArrayView.offset()and offset() +ByteArrayView.length(). NB: no data is copied when doing this- Specified by:
arrayin classByteArrayView- Returns:
- the backing array
-
offset
public int offset()Description copied from class:ByteArrayViewreturn the offset into the backing array of this view NB: no data is copied when doing this- Specified by:
offsetin classByteArrayView- Returns:
- the offset in bytes
-
length
public int length()Description copied from class:ByteArrayViewreturn the length of this view NB: no data is copied when doing this- Specified by:
lengthin classByteArrayView- Returns:
- the length in bytes
-
copy
Description copied from class:ByteArrayViewCreate 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:
copyin classByteArrayView- 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
Description copied from class:ByteArrayViewCreate 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:
copyin classByteArrayView- Returns:
- the new ByteArrayView
- See Also:
-
copyBytes
public byte[] copyBytes(int off, int len) Description copied from class:ByteArrayViewCreate a new byte[] containing a copy of this view's data within the provided window. The returned array may be indexed from 0, unlikeByteArrayView.array(). NB: this method copies the underlying data- Specified by:
copyBytesin classByteArrayView- 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:ByteArrayViewCreate a new byte[] containing a copy of this view's data. The returned array may be indexed from 0, unlikeByteArrayView.array(). NB: this method copies the underlying data- Specified by:
copyBytesin classByteArrayView- Returns:
- a new byte[] containing a copy of this view's data
-