public class ByteBufferAccessor extends java.lang.Object implements ValueAccessor<java.nio.ByteBuffer>
Buffer.position() as index 0,
and Buffer.remaining() as the length.ValueAccessor.ObjectFactory<V>| Modifier and Type | Field and Description |
|---|---|
static ValueAccessor<java.nio.ByteBuffer> |
instance |
| Modifier and Type | Method and Description |
|---|---|
java.nio.ByteBuffer |
allocate(int size)
Allocate and return a instance of bytes on the heap.
|
<V2> int |
compare(java.nio.ByteBuffer left,
V2 right,
ValueAccessor<V2> accessorR)
lexicographically compare to
|
int |
compareByteArrayTo(byte[] left,
java.nio.ByteBuffer right)
compare a byte array on the left with a on the right}
|
int |
compareByteBufferTo(java.nio.ByteBuffer left,
java.nio.ByteBuffer right)
compare a byte buffer on the left with a on the right}
|
<V2> java.nio.ByteBuffer |
convert(V2 src,
ValueAccessor<V2> accessor)
Convert the data in to
and the returned value may share a common byte array instance, so caller should
assume that modifying the returned value will also modify the contents of
|
int |
copyByteArrayTo(byte[] src,
int srcOffset,
java.nio.ByteBuffer dst,
int dstOffset,
int size)
copies a byte array into this accessors value.
|
int |
copyByteBufferTo(java.nio.ByteBuffer src,
int srcOffset,
java.nio.ByteBuffer dst,
int dstOffset,
int size)
copies a byte buffer into this accessors value.
|
<V2> int |
copyTo(java.nio.ByteBuffer src,
int srcOffset,
V2 dst,
ValueAccessor<V2> dstAccessor,
int dstOffset,
int size)
copy the bytes from the value, starting at the offset into
the value, starting at the offset , using the accessor
|
java.nio.ByteBuffer[] |
createArray(int length)
allocate an instance of the accessors backing type
|
void |
digest(java.nio.ByteBuffer value,
int offset,
int size,
Digest digest)
updates with bytes from the contents of starting
at offset
|
java.nio.ByteBuffer |
empty()
return a value with a length of 0
|
ValueAccessor.ObjectFactory<java.nio.ByteBuffer> |
factory()
returns the
ValueAccessor.ObjectFactory for the backing type |
byte |
getByte(java.nio.ByteBuffer value,
int offset)
returns a byte from offset
|
int |
getInt(java.nio.ByteBuffer value,
int offset)
returns an int from offset
|
long |
getLong(java.nio.ByteBuffer value,
int offset)
returns a long from offset
|
short |
getShort(java.nio.ByteBuffer value,
int offset)
returns a short from offset
|
int |
getUnsignedShort(java.nio.ByteBuffer value,
int offset)
returns an unsigned short from offset
|
int |
putInt(java.nio.ByteBuffer dst,
int offset,
int value)
writes the int value to at offset
|
int |
putLong(java.nio.ByteBuffer dst,
int offset,
long value)
writes the long value to at offset
|
int |
putShort(java.nio.ByteBuffer dst,
int offset,
short value)
writes the short value to at offset
|
java.nio.ByteBuffer |
read(DataInputPlus in,
int length)
Reads a value of bytes from
|
int |
size(java.nio.ByteBuffer value) |
java.nio.ByteBuffer |
slice(java.nio.ByteBuffer input,
int offset,
int length)
Returns a value with the contents of from to .
|
byte[] |
toArray(java.nio.ByteBuffer value)
returns a byte[] with the contents of
Depending on the accessor implementation, this method may:
* allocate a new byte[] object and copy data into it
* return the value, if the backing type is byte[]
|
byte[] |
toArray(java.nio.ByteBuffer value,
int offset,
int length)
returns a byte[] with bytes copied from the contents of
starting at offset .
|
java.nio.ByteBuffer |
toBuffer(java.nio.ByteBuffer value)
returns a ByteBuffer with the contents of
Depending on the accessor implementation, this method may:
* allocate a new ByteBuffer and copy data into it
* return the value, if the backing type is a bytebuffer
|
byte |
toByte(java.nio.ByteBuffer value)
returns a byte from offset 0
|
double |
toDouble(java.nio.ByteBuffer value)
returns a double from offset 0
|
float |
toFloat(java.nio.ByteBuffer value)
returns a float from offset 0
|
java.lang.String |
toHex(java.nio.ByteBuffer value) |
int |
toInt(java.nio.ByteBuffer value)
returns an int from offset 0
|
long |
toLong(java.nio.ByteBuffer value)
returns a long from offset 0
|
short |
toShort(java.nio.ByteBuffer value)
returns a short from offset 0
|
java.lang.String |
toString(java.nio.ByteBuffer value,
java.nio.charset.Charset charset) |
java.util.UUID |
toUUID(java.nio.ByteBuffer value)
returns a UUID from offset 0
|
java.nio.ByteBuffer |
valueOf(boolean v)
return a value with the bytes from
|
java.nio.ByteBuffer |
valueOf(byte v)
return a value with the bytes from
|
java.nio.ByteBuffer |
valueOf(byte[] bytes)
return a value containing the
Caller should assume that modifying the returned value
will also modify the contents of
|
java.nio.ByteBuffer |
valueOf(java.nio.ByteBuffer bytes)
return a value containing the
and the returned value may share a common byte array instance, so caller should
assume that modifying the returned value will also modify the contents of
|
java.nio.ByteBuffer |
valueOf(double v)
return a value with the bytes from
|
java.nio.ByteBuffer |
valueOf(float v)
return a value with the bytes from
|
java.nio.ByteBuffer |
valueOf(int v)
return a value with the bytes from
|
java.nio.ByteBuffer |
valueOf(long v)
return a value with the bytes from
|
java.nio.ByteBuffer |
valueOf(short v)
return a value with the bytes from
|
java.nio.ByteBuffer |
valueOf(java.lang.String v,
java.nio.charset.Charset charset)
return a value containing the bytes for the given string and charset
|
java.nio.ByteBuffer |
valueOf(java.util.UUID v)
return a value with the bytes from
|
void |
write(java.nio.ByteBuffer value,
java.nio.ByteBuffer out)
Write the contents of the given value into the ByteBuffer
|
void |
write(java.nio.ByteBuffer value,
DataOutputPlus out)
Write the contents of the given value into the a DataOutputPlus
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompare, digest, equals, getBoolean, hashCode, isEmpty, isEmptyFromOffset, sizeFromOffset, sizeWithShortLength, sizeWithVIntLength, sliceWithShortLength, toString, writeWithVIntLengthpublic static final ValueAccessor<java.nio.ByteBuffer> instance
public int size(java.nio.ByteBuffer value)
size in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer[] createArray(int length)
ValueAccessorcreateArray in interface ValueAccessor<java.nio.ByteBuffer>length - size of backing typ to allocatepublic void write(java.nio.ByteBuffer value,
DataOutputPlus out)
throws java.io.IOException
ValueAccessorwrite in interface ValueAccessor<java.nio.ByteBuffer>java.io.IOExceptionpublic void write(java.nio.ByteBuffer value,
java.nio.ByteBuffer out)
ValueAccessorwrite in interface ValueAccessor<java.nio.ByteBuffer>public <V2> int copyTo(java.nio.ByteBuffer src,
int srcOffset,
V2 dst,
ValueAccessor<V2> dstAccessor,
int dstOffset,
int size)
ValueAccessorcopyTo in interface ValueAccessor<java.nio.ByteBuffer>V2 - the destination value typepublic int copyByteArrayTo(byte[] src,
int srcOffset,
java.nio.ByteBuffer dst,
int dstOffset,
int size)
ValueAccessorcopyByteArrayTo in interface ValueAccessor<java.nio.ByteBuffer>public int copyByteBufferTo(java.nio.ByteBuffer src,
int srcOffset,
java.nio.ByteBuffer dst,
int dstOffset,
int size)
ValueAccessorcopyByteBufferTo in interface ValueAccessor<java.nio.ByteBuffer>public void digest(java.nio.ByteBuffer value,
int offset,
int size,
Digest digest)
ValueAccessordigest in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer read(DataInputPlus in, int length) throws java.io.IOException
ValueAccessorread in interface ValueAccessor<java.nio.ByteBuffer>java.io.IOExceptionpublic java.nio.ByteBuffer slice(java.nio.ByteBuffer input,
int offset,
int length)
ValueAccessorslice in interface ValueAccessor<java.nio.ByteBuffer>public <V2> int compare(java.nio.ByteBuffer left,
V2 right,
ValueAccessor<V2> accessorR)
ValueAccessorcompare in interface ValueAccessor<java.nio.ByteBuffer>V2 - backing type ofpublic int compareByteArrayTo(byte[] left,
java.nio.ByteBuffer right)
ValueAccessorcompareByteArrayTo in interface ValueAccessor<java.nio.ByteBuffer>public int compareByteBufferTo(java.nio.ByteBuffer left,
java.nio.ByteBuffer right)
ValueAccessorcompareByteBufferTo in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer toBuffer(java.nio.ByteBuffer value)
ValueAccessortoBuffer in interface ValueAccessor<java.nio.ByteBuffer>public byte[] toArray(java.nio.ByteBuffer value)
ValueAccessortoArray in interface ValueAccessor<java.nio.ByteBuffer>public byte[] toArray(java.nio.ByteBuffer value,
int offset,
int length)
ValueAccessortoArray in interface ValueAccessor<java.nio.ByteBuffer>public java.lang.String toString(java.nio.ByteBuffer value,
java.nio.charset.Charset charset)
throws java.nio.charset.CharacterCodingException
toString in interface ValueAccessor<java.nio.ByteBuffer>java.nio.charset.CharacterCodingExceptionpublic java.nio.ByteBuffer valueOf(java.util.UUID v)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public java.lang.String toHex(java.nio.ByteBuffer value)
toHex in interface ValueAccessor<java.nio.ByteBuffer>public byte toByte(java.nio.ByteBuffer value)
ValueAccessortoByte in interface ValueAccessor<java.nio.ByteBuffer>public byte getByte(java.nio.ByteBuffer value,
int offset)
ValueAccessorgetByte in interface ValueAccessor<java.nio.ByteBuffer>public short toShort(java.nio.ByteBuffer value)
ValueAccessortoShort in interface ValueAccessor<java.nio.ByteBuffer>public short getShort(java.nio.ByteBuffer value,
int offset)
ValueAccessorgetShort in interface ValueAccessor<java.nio.ByteBuffer>public int getUnsignedShort(java.nio.ByteBuffer value,
int offset)
ValueAccessorgetUnsignedShort in interface ValueAccessor<java.nio.ByteBuffer>public int toInt(java.nio.ByteBuffer value)
ValueAccessortoInt in interface ValueAccessor<java.nio.ByteBuffer>public int getInt(java.nio.ByteBuffer value,
int offset)
ValueAccessorgetInt in interface ValueAccessor<java.nio.ByteBuffer>public long toLong(java.nio.ByteBuffer value)
ValueAccessortoLong in interface ValueAccessor<java.nio.ByteBuffer>public long getLong(java.nio.ByteBuffer value,
int offset)
ValueAccessorgetLong in interface ValueAccessor<java.nio.ByteBuffer>public float toFloat(java.nio.ByteBuffer value)
ValueAccessortoFloat in interface ValueAccessor<java.nio.ByteBuffer>public double toDouble(java.nio.ByteBuffer value)
ValueAccessortoDouble in interface ValueAccessor<java.nio.ByteBuffer>public java.util.UUID toUUID(java.nio.ByteBuffer value)
ValueAccessortoUUID in interface ValueAccessor<java.nio.ByteBuffer>public int putShort(java.nio.ByteBuffer dst,
int offset,
short value)
ValueAccessorputShort in interface ValueAccessor<java.nio.ByteBuffer>public int putInt(java.nio.ByteBuffer dst,
int offset,
int value)
ValueAccessorputInt in interface ValueAccessor<java.nio.ByteBuffer>public int putLong(java.nio.ByteBuffer dst,
int offset,
long value)
ValueAccessorputLong in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer empty()
ValueAccessorempty in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer valueOf(byte[] bytes)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer valueOf(java.nio.ByteBuffer bytes)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer valueOf(java.lang.String v,
java.nio.charset.Charset charset)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer valueOf(boolean v)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer valueOf(byte v)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer valueOf(short v)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer valueOf(int v)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer valueOf(long v)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer valueOf(float v)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer valueOf(double v)
ValueAccessorvalueOf in interface ValueAccessor<java.nio.ByteBuffer>public <V2> java.nio.ByteBuffer convert(V2 src,
ValueAccessor<V2> accessor)
ValueAccessorconvert in interface ValueAccessor<java.nio.ByteBuffer>public java.nio.ByteBuffer allocate(int size)
ValueAccessorallocate in interface ValueAccessor<java.nio.ByteBuffer>public ValueAccessor.ObjectFactory<java.nio.ByteBuffer> factory()
ValueAccessorValueAccessor.ObjectFactory for the backing type factory in interface ValueAccessor<java.nio.ByteBuffer>Copyright © 2009-2020 The Apache Software Foundation