public class ByteArrayAccessor extends java.lang.Object implements ValueAccessor<byte[]>
ValueAccessor.ObjectFactory<V>
Modifier and Type | Field and Description |
---|---|
static ValueAccessor.ObjectFactory<byte[]> |
factory |
static ValueAccessor<byte[]> |
instance |
Modifier and Type | Method and Description |
---|---|
byte[] |
allocate(int size)
Allocate and return a instance of bytes on the heap.
|
<V2> int |
compare(byte[] left,
V2 right,
ValueAccessor<V2> accessorR)
lexicographically compare to
|
int |
compareByteArrayTo(byte[] left,
byte[] right)
compare a byte array on the left with a on the right}
|
int |
compareByteBufferTo(java.nio.ByteBuffer left,
byte[] right)
compare a byte buffer on the left with a on the right}
|
<V2> byte[] |
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,
byte[] dst,
int dstOffset,
int size)
copies a byte array into this accessors value.
|
int |
copyByteBufferTo(java.nio.ByteBuffer src,
int srcOffset,
byte[] dst,
int dstOffset,
int size)
copies a byte buffer into this accessors value.
|
<V2> int |
copyTo(byte[] 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
|
byte[][] |
createArray(int length)
allocate an instance of the accessors backing type
|
void |
digest(byte[] value,
int offset,
int size,
Digest digest)
updates with bytes from the contents of starting
at offset
|
byte[] |
empty()
return a value with a length of 0
|
ValueAccessor.ObjectFactory<byte[]> |
factory()
returns the
ValueAccessor.ObjectFactory for the backing type |
byte |
getByte(byte[] value,
int offset)
returns a byte from offset
|
int |
getInt(byte[] value,
int offset)
returns an int from offset
|
long |
getLong(byte[] value,
int offset)
returns a long from offset
|
short |
getShort(byte[] value,
int offset)
returns a short from offset
|
int |
getUnsignedShort(byte[] value,
int offset)
returns an unsigned short from offset
|
int |
putByte(byte[] dst,
int offset,
byte value)
writes the byte value to at offset
|
int |
putInt(byte[] dst,
int offset,
int value)
writes the int value to at offset
|
int |
putLong(byte[] dst,
int offset,
long value)
writes the long value to at offset
|
int |
putShort(byte[] dst,
int offset,
short value)
writes the short value to at offset
|
byte[] |
read(DataInputPlus in,
int length)
Reads a value of bytes from
|
int |
size(byte[] value) |
byte[] |
slice(byte[] input,
int offset,
int length)
Returns a value with the contents of from to .
|
byte[] |
toArray(byte[] 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(byte[] value,
int offset,
int length)
returns a byte[] with bytes copied from the contents of
starting at offset .
|
java.nio.ByteBuffer |
toBuffer(byte[] 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(byte[] value)
returns a byte from offset 0
|
double |
toDouble(byte[] value)
returns a double from offset 0
|
float |
toFloat(byte[] value)
returns a float from offset 0
|
java.lang.String |
toHex(byte[] value) |
int |
toInt(byte[] value)
returns an int from offset 0
|
long |
toLong(byte[] value)
returns a long from offset 0
|
short |
toShort(byte[] value)
returns a short from offset 0
|
java.lang.String |
toString(byte[] value,
java.nio.charset.Charset charset) |
java.util.UUID |
toUUID(byte[] value)
returns a UUID from offset 0
|
byte[] |
valueOf(boolean v)
return a value with the bytes from
|
byte[] |
valueOf(byte v)
return a value with the bytes from
|
byte[] |
valueOf(byte[] bytes)
return a value containing the
Caller should assume that modifying the returned value
will also modify the contents of
|
byte[] |
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
|
byte[] |
valueOf(double v)
return a value with the bytes from
|
byte[] |
valueOf(float v)
return a value with the bytes from
|
byte[] |
valueOf(int v)
return a value with the bytes from
|
byte[] |
valueOf(long v)
return a value with the bytes from
|
byte[] |
valueOf(short v)
return a value with the bytes from
|
byte[] |
valueOf(java.lang.String s,
java.nio.charset.Charset charset)
return a value containing the bytes for the given string and charset
|
byte[] |
valueOf(java.util.UUID v)
return a value with the bytes from
|
void |
write(byte[] value,
java.nio.ByteBuffer out)
Write the contents of the given value into the ByteBuffer
|
void |
write(byte[] value,
DataOutputPlus out)
Write the contents of the given value into the a DataOutputPlus
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compare, digest, equals, getBoolean, hashCode, isEmpty, isEmptyFromOffset, sizeFromOffset, sizeWithShortLength, sizeWithVIntLength, sliceWithShortLength, toString, writeWithVIntLength
public static final ValueAccessor<byte[]> instance
public static final ValueAccessor.ObjectFactory<byte[]> factory
public int size(byte[] value)
size
in interface ValueAccessor<byte[]>
public byte[][] createArray(int length)
ValueAccessor
createArray
in interface ValueAccessor<byte[]>
length
- size of backing typ to allocatepublic void write(byte[] value, DataOutputPlus out) throws java.io.IOException
ValueAccessor
write
in interface ValueAccessor<byte[]>
java.io.IOException
public void write(byte[] value, java.nio.ByteBuffer out)
ValueAccessor
write
in interface ValueAccessor<byte[]>
public <V2> int copyTo(byte[] src, int srcOffset, V2 dst, ValueAccessor<V2> dstAccessor, int dstOffset, int size)
ValueAccessor
copyTo
in interface ValueAccessor<byte[]>
V2
- the destination value typepublic int copyByteArrayTo(byte[] src, int srcOffset, byte[] dst, int dstOffset, int size)
ValueAccessor
copyByteArrayTo
in interface ValueAccessor<byte[]>
public int copyByteBufferTo(java.nio.ByteBuffer src, int srcOffset, byte[] dst, int dstOffset, int size)
ValueAccessor
copyByteBufferTo
in interface ValueAccessor<byte[]>
public void digest(byte[] value, int offset, int size, Digest digest)
ValueAccessor
digest
in interface ValueAccessor<byte[]>
public byte[] read(DataInputPlus in, int length) throws java.io.IOException
ValueAccessor
read
in interface ValueAccessor<byte[]>
java.io.IOException
public byte[] slice(byte[] input, int offset, int length)
ValueAccessor
slice
in interface ValueAccessor<byte[]>
public <V2> int compare(byte[] left, V2 right, ValueAccessor<V2> accessorR)
ValueAccessor
compare
in interface ValueAccessor<byte[]>
V2
- backing type ofpublic int compareByteArrayTo(byte[] left, byte[] right)
ValueAccessor
compareByteArrayTo
in interface ValueAccessor<byte[]>
public int compareByteBufferTo(java.nio.ByteBuffer left, byte[] right)
ValueAccessor
compareByteBufferTo
in interface ValueAccessor<byte[]>
public java.nio.ByteBuffer toBuffer(byte[] value)
ValueAccessor
toBuffer
in interface ValueAccessor<byte[]>
public byte[] toArray(byte[] value)
ValueAccessor
toArray
in interface ValueAccessor<byte[]>
public byte[] toArray(byte[] value, int offset, int length)
ValueAccessor
toArray
in interface ValueAccessor<byte[]>
public java.lang.String toString(byte[] value, java.nio.charset.Charset charset) throws java.nio.charset.CharacterCodingException
toString
in interface ValueAccessor<byte[]>
java.nio.charset.CharacterCodingException
public java.lang.String toHex(byte[] value)
toHex
in interface ValueAccessor<byte[]>
public byte toByte(byte[] value)
ValueAccessor
toByte
in interface ValueAccessor<byte[]>
public byte getByte(byte[] value, int offset)
ValueAccessor
getByte
in interface ValueAccessor<byte[]>
public short toShort(byte[] value)
ValueAccessor
toShort
in interface ValueAccessor<byte[]>
public short getShort(byte[] value, int offset)
ValueAccessor
getShort
in interface ValueAccessor<byte[]>
public int getUnsignedShort(byte[] value, int offset)
ValueAccessor
getUnsignedShort
in interface ValueAccessor<byte[]>
public int toInt(byte[] value)
ValueAccessor
toInt
in interface ValueAccessor<byte[]>
public int getInt(byte[] value, int offset)
ValueAccessor
getInt
in interface ValueAccessor<byte[]>
public long toLong(byte[] value)
ValueAccessor
toLong
in interface ValueAccessor<byte[]>
public long getLong(byte[] value, int offset)
ValueAccessor
getLong
in interface ValueAccessor<byte[]>
public float toFloat(byte[] value)
ValueAccessor
toFloat
in interface ValueAccessor<byte[]>
public double toDouble(byte[] value)
ValueAccessor
toDouble
in interface ValueAccessor<byte[]>
public java.util.UUID toUUID(byte[] value)
ValueAccessor
toUUID
in interface ValueAccessor<byte[]>
public int putByte(byte[] dst, int offset, byte value)
ValueAccessor
putByte
in interface ValueAccessor<byte[]>
public int putShort(byte[] dst, int offset, short value)
ValueAccessor
putShort
in interface ValueAccessor<byte[]>
public int putInt(byte[] dst, int offset, int value)
ValueAccessor
putInt
in interface ValueAccessor<byte[]>
public int putLong(byte[] dst, int offset, long value)
ValueAccessor
putLong
in interface ValueAccessor<byte[]>
public byte[] empty()
ValueAccessor
empty
in interface ValueAccessor<byte[]>
public byte[] valueOf(byte[] bytes)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public byte[] valueOf(java.nio.ByteBuffer bytes)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public byte[] valueOf(java.lang.String s, java.nio.charset.Charset charset)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public byte[] valueOf(java.util.UUID v)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public byte[] valueOf(boolean v)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public byte[] valueOf(byte v)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public byte[] valueOf(short v)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public byte[] valueOf(int v)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public byte[] valueOf(long v)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public byte[] valueOf(float v)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public byte[] valueOf(double v)
ValueAccessor
valueOf
in interface ValueAccessor<byte[]>
public <V2> byte[] convert(V2 src, ValueAccessor<V2> accessor)
ValueAccessor
convert
in interface ValueAccessor<byte[]>
public byte[] allocate(int size)
ValueAccessor
allocate
in interface ValueAccessor<byte[]>
public ValueAccessor.ObjectFactory<byte[]> factory()
ValueAccessor
ValueAccessor.ObjectFactory
for the backing type factory
in interface ValueAccessor<byte[]>
Copyright © 2009- The Apache Software Foundation