public final class BinaryObjectImpl extends BinaryObjectExImpl implements Externalizable, KeyCacheObject
TYPE_BINARY, TYPE_BINARY_ENUM, TYPE_BYTE_ARR, TYPE_REGULAR
DIRECT_TYPE_SIZE
Constructor and Description |
---|
BinaryObjectImpl()
For
Externalizable . |
BinaryObjectImpl(BinaryContext ctx,
byte[] arr,
int start) |
Modifier and Type | Method and Description |
---|---|
byte[] |
array() |
byte |
cacheObjectType() |
BinaryObject |
clone()
Copies this binary object.
|
BinaryContext |
context()
Get binary context.
|
void |
context(BinaryContext ctx) |
KeyCacheObject |
copy(int part) |
BinarySerializedFieldComparator |
createFieldComparator()
Create field comparer.
|
BinarySchema |
createSchema()
Create schema for object.
|
int |
dataStartOffset()
Get offset of data begin.
|
<T> T |
deserialize()
Gets fully deserialized instance of binary object.
|
BinaryObject |
detach() |
void |
detachAllowed(boolean detachAllowed) |
boolean |
detached() |
short |
directType()
Gets message type.
|
protected <F> F |
field(BinaryReaderHandles rCtx,
String fieldName) |
<F> F |
field(int fieldId)
Gets field value.
|
<F> F |
field(String fieldName)
Gets field value.
|
<F> F |
fieldByOrder(int order)
Get field by offset.
|
byte |
fieldsCount()
Gets fields count.
|
void |
finishUnmarshal(CacheObjectContext ctx,
ClassLoader ldr) |
int |
footerStartOffset()
Get offset of the footer begin.
|
boolean |
hasArray() |
boolean |
hasField(String fieldName)
Checks whether field exists in the object.
|
int |
hashCode() |
boolean |
hasSchema() |
boolean |
internal() |
boolean |
isFlagSet(short flag)
Check if flag set.
|
boolean |
isPlatformType()
Gets flag indicating whether object value is a platform type.
|
int |
length() |
long |
offheapAddress() |
void |
onAckReceived()
Method called when ack message received.
|
int |
partition() |
void |
partition(int part)
Sets partition ID for this key.
|
CacheObject |
prepareForCache(CacheObjectContext ctx)
Prepares cache object for cache (e.g. copies user-provided object if needed).
|
void |
prepareMarshal(CacheObjectContext ctx) |
boolean |
putValue(ByteBuffer buf) |
boolean |
putValue(ByteBuffer buf,
int off,
int len) |
int |
putValue(long addr) |
BinaryType |
rawType()
Get raw type.
|
void |
readExternal(ObjectInput in) |
boolean |
readFrom(ByteBuffer buf,
MessageReader reader)
Reads this message from provided byte buffer.
|
int |
schemaId()
Get schema ID.
|
int |
start() |
String |
toString() |
BinaryType |
type()
Gets type information for this binary object.
|
int |
typeId() |
<T> T |
value(CacheObjectContext ctx,
boolean cpy) |
byte[] |
valueBytes(CacheObjectContext ctx) |
int |
valueBytesLength(CacheObjectContext ctx) |
void |
writeExternal(ObjectOutput out) |
boolean |
writeFieldByOrder(int order,
ByteBuffer buf)
Writes field value defined by the given field offset to the given byte buffer.
|
boolean |
writeTo(ByteBuffer buf,
MessageWriter writer)
Writes this message to provided byte buffer.
|
enumOrdinal, equals, toBuilder
public BinaryObjectImpl()
Externalizable
.public BinaryObjectImpl(BinaryContext ctx, byte[] arr, int start)
ctx
- Context.arr
- Array.start
- Start.public KeyCacheObject copy(int part)
copy
in interface KeyCacheObject
part
- Partition ID.public int partition()
partition
in interface KeyCacheObject
public void partition(int part)
partition
in interface KeyCacheObject
part
- Partition ID.public byte cacheObjectType()
cacheObjectType
in interface CacheObject
public boolean isPlatformType()
IgniteCache.withKeepBinary()
is used or not.isPlatformType
in interface CacheObject
public boolean internal()
internal
in interface KeyCacheObject
True
if internal cache key.@Nullable public <T> T value(CacheObjectContext ctx, boolean cpy)
value
in interface CacheObject
ctx
- Context.cpy
- If true
need to copy value.public byte[] valueBytes(CacheObjectContext ctx) throws IgniteCheckedException
valueBytes
in interface CacheObject
ctx
- Context.IgniteCheckedException
- If failed.public boolean putValue(ByteBuffer buf) throws IgniteCheckedException
putValue
in interface CacheObject
buf
- Buffer to write value to.True
if value was successfully written, false
if there was not enough space in the
buffer.IgniteCheckedException
- If failed.public int putValue(long addr) throws IgniteCheckedException
putValue
in interface CacheObject
addr
- Address tp write value to.IgniteCheckedException
- If failed.public boolean putValue(ByteBuffer buf, int off, int len) throws IgniteCheckedException
putValue
in interface CacheObject
buf
- Buffer to write value to.off
- Offset in source binary data.len
- Length of the data to write.True
if value was successfully written, false
if there was not enough space in the
buffer.IgniteCheckedException
- If failed.public int valueBytesLength(CacheObjectContext ctx) throws IgniteCheckedException
valueBytesLength
in interface CacheObject
ctx
- Cache object context.IgniteCheckedException
- If failed.public CacheObject prepareForCache(CacheObjectContext ctx)
prepareForCache
in interface CacheObject
ctx
- Cache context.public void finishUnmarshal(CacheObjectContext ctx, ClassLoader ldr) throws IgniteCheckedException
finishUnmarshal
in interface CacheObject
ctx
- Context.ldr
- Class loader.IgniteCheckedException
- If failed.public void prepareMarshal(CacheObjectContext ctx) throws IgniteCheckedException
prepareMarshal
in interface CacheObject
ctx
- Context.IgniteCheckedException
- If failed.public int length()
length
in class BinaryObjectExImpl
public BinaryObject detach()
public boolean detached()
public void detachAllowed(boolean detachAllowed)
detachAllowed
- Detach allowed flag.public BinaryContext context()
context
in class BinaryObjectExImpl
public void context(BinaryContext ctx)
ctx
- Context.public byte[] array()
array
in class BinaryObjectExImpl
null
.public int start()
start
in class BinaryObjectExImpl
public long offheapAddress()
offheapAddress
in class BinaryObjectExImpl
public boolean hasArray()
hasArray
in class BinaryObjectExImpl
True
if object is array based.public boolean isFlagSet(short flag)
isFlagSet
in interface BinaryObjectEx
flag
- flag to check.true
if flag is set, false
otherwise.public int typeId()
typeId
in interface BinaryObjectEx
@Nullable public BinaryType type() throws BinaryObjectException
type
in interface BinaryObject
BinaryObjectException
- In case of error.@Nullable public BinaryType rawType() throws BinaryObjectException
rawType
in interface BinaryObjectEx
BinaryObjectException
- If failed.@Nullable public <F> F field(String fieldName) throws BinaryObjectException
field
in interface BinaryObject
fieldName
- Field name.BinaryObjectException
- In case of any other error.@Nullable public <F> F field(int fieldId) throws BinaryObjectException
field
in class BinaryObjectExImpl
fieldId
- Field ID.BinaryObjectException
- In case of any other error.public BinarySerializedFieldComparator createFieldComparator()
createFieldComparator
in class BinaryObjectExImpl
public int dataStartOffset()
dataStartOffset
in class BinaryObjectExImpl
public int footerStartOffset()
footerStartOffset
in class BinaryObjectExImpl
@Nullable public <F> F fieldByOrder(int order)
fieldByOrder
in class BinaryObjectExImpl
order
- Field offset.public boolean writeFieldByOrder(int order, ByteBuffer buf)
writeFieldByOrder
in class BinaryObjectExImpl
order
- Field offset.false
if there is no enough space for the field in the buffer.@Nullable protected <F> F field(BinaryReaderHandles rCtx, String fieldName)
field
in class BinaryObjectExImpl
rCtx
- Reader context.fieldName
- Field name.public boolean hasField(String fieldName)
hasField
in interface BinaryObject
fieldName
- Field name.True
if field exists.@Nullable public <T> T deserialize() throws BinaryObjectException
deserialize
in interface BinaryObject
BinaryInvalidTypeException
- If class doesn't exist.BinaryObjectException
- In case of any other error.public BinaryObject clone() throws CloneNotSupportedException
clone
in interface BinaryObject
clone
in class BinaryObjectExImpl
CloneNotSupportedException
public int hashCode()
hashCode
in interface KeyCacheObject
hashCode
in class Object
public boolean hasSchema()
hasSchema
in class BinaryObjectExImpl
True
if object has schema.public int schemaId()
schemaId
in class BinaryObjectExImpl
public BinarySchema createSchema()
createSchema
in class BinaryObjectExImpl
public void onAckReceived()
onAckReceived
in interface Message
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public boolean writeTo(ByteBuffer buf, MessageWriter writer)
public boolean readFrom(ByteBuffer buf, MessageReader reader)
public short directType()
directType
in interface Message
public byte fieldsCount()
fieldsCount
in interface Message
public String toString()
toString
in class BinaryObjectExImpl
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017