final class DirectByteArrayView extends ByteArrayView
Constructor and Description |
---|
DirectByteArrayView(byte[] data) |
DirectByteArrayView(byte[] data,
int off,
int len) |
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
|
asString, clone, compareTo, equals, get, hashCode, makeCopiedView, makeCopiedView, makeView, makeView, makeView, toString
public DirectByteArrayView(byte[] data)
public DirectByteArrayView(byte[] data, int off, int len)
public ByteArrayView slice(int off, int len)
ByteArrayView
slice
in class ByteArrayView
off
- the initial offset of the window (relative to the current window)len
- the length of the windowpublic ByteBuffer view(int off, int len)
ByteArrayView
view
in class ByteArrayView
off
- the initial offset of the window (relative to the current window)len
- the length of the windowpublic ByteBuffer view()
ByteArrayView
view
in class ByteArrayView
public byte[] array()
ByteArrayView
ByteArrayView.offset()
and offset() + ByteArrayView.length()
.
NB: no data is copied when doing thisarray
in class ByteArrayView
public int offset()
ByteArrayView
offset
in class ByteArrayView
public int length()
ByteArrayView
length
in class ByteArrayView
public ByteArrayView copy(int off, int len)
ByteArrayView
copy
in class ByteArrayView
off
- the initial offset of the window (relative to the current window)len
- the length of the windowif you need a copy of the data in a byte[] indexed from 0 rather than offset()
public ByteArrayView copy()
ByteArrayView
copy
in class ByteArrayView
if you need a copy of the data in a byte[] indexed from 0 rather than offset()
public byte[] copyBytes(int off, int len)
ByteArrayView
ByteArrayView.array()
.
NB: this method copies the underlying datacopyBytes
in class ByteArrayView
off
- the initial offset of the window (relative to the current window)len
- the length of the windowpublic byte[] copyBytes()
ByteArrayView
ByteArrayView.array()
.
NB: this method copies the underlying datacopyBytes
in class ByteArrayView
Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.