Class CacheObjectByteArrayImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.CacheObjectByteArrayImpl
-
- All Implemented Interfaces:
Externalizable,Serializable,CacheObject,Message
- Direct Known Subclasses:
UserCacheObjectByteArrayImpl
public class CacheObjectByteArrayImpl extends Object implements CacheObject, Externalizable
Cache object over byte array.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]val-
Fields inherited from interface org.apache.ignite.internal.processors.cache.CacheObject
TYPE_BINARY, TYPE_BINARY_ENUM, TYPE_BYTE_ARR, TYPE_REGULAR
-
Fields inherited from interface org.apache.ignite.plugin.extensions.communication.Message
DIRECT_TYPE_SIZE
-
-
Constructor Summary
Constructors Constructor Description CacheObjectByteArrayImpl()Required byMessage.CacheObjectByteArrayImpl(byte[] val)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description bytecacheObjectType()shortdirectType()Gets message type.bytefieldsCount()Gets fields count.voidfinishUnmarshal(CacheObjectValueContext ctx, ClassLoader ldr)booleanisPlatformType()Gets flag indicating whether object value is a platform type.voidonAckReceived()Method called when ack message received.CacheObjectprepareForCache(CacheObjectContext ctx)Prepares cache object for cache (e.g. copies user-provided object if needed).voidprepareMarshal(CacheObjectValueContext ctx)intputValue(long addr)booleanputValue(ByteBuffer buf)booleanputValue(ByteBuffer buf, int off, int len)voidreadExternal(ObjectInput in)booleanreadFrom(ByteBuffer buf, MessageReader reader)Reads this message from provided byte buffer.StringtoString()<T> Tvalue(CacheObjectValueContext ctx, boolean cpy)<T> Tvalue(CacheObjectValueContext ctx, boolean cpy, ClassLoader ldr)Deserializes a value from an internal representation.byte[]valueBytes(CacheObjectValueContext ctx)intvalueBytesLength(CacheObjectContext ctx)voidwriteExternal(ObjectOutput out)booleanwriteTo(ByteBuffer buf, MessageWriter writer)Writes this message to provided byte buffer.
-
-
-
Constructor Detail
-
CacheObjectByteArrayImpl
public CacheObjectByteArrayImpl()
Required byMessage.
-
CacheObjectByteArrayImpl
public CacheObjectByteArrayImpl(byte[] val)
- Parameters:
val- Value.
-
-
Method Detail
-
finishUnmarshal
public void finishUnmarshal(CacheObjectValueContext ctx, ClassLoader ldr) throws IgniteCheckedException
- Specified by:
finishUnmarshalin interfaceCacheObject- Parameters:
ctx- Context.ldr- Class loader.- Throws:
IgniteCheckedException- If failed.
-
value
@Nullable public <T> T value(CacheObjectValueContext ctx, boolean cpy)
- Specified by:
valuein interfaceCacheObject- Parameters:
ctx- Context.cpy- Iftrueneed to copy value.- Returns:
- Value.
-
value
@Nullable public <T> T value(CacheObjectValueContext ctx, boolean cpy, ClassLoader ldr)
Deserializes a value from an internal representation.- Specified by:
valuein interfaceCacheObject- Parameters:
ctx- Context.cpy- Iftrueneed to copy value.ldr- Class loader, if it isnull, default class loader will be used.- Returns:
- Value.
-
valueBytes
public byte[] valueBytes(CacheObjectValueContext ctx) throws IgniteCheckedException
- Specified by:
valueBytesin interfaceCacheObject- Parameters:
ctx- Context.- Returns:
- Value bytes.
- Throws:
IgniteCheckedException- If failed.
-
putValue
public boolean putValue(ByteBuffer buf) throws IgniteCheckedException
- Specified by:
putValuein interfaceCacheObject- Parameters:
buf- Buffer to write value to.- Returns:
Trueif value was successfully written,falseif there was not enough space in the buffer.- Throws:
IgniteCheckedException- If failed.
-
putValue
public int putValue(long addr) throws IgniteCheckedException- Specified by:
putValuein interfaceCacheObject- Parameters:
addr- Address tp write value to.- Returns:
- Number of bytes written.
- Throws:
IgniteCheckedException- If failed.
-
putValue
public boolean putValue(ByteBuffer buf, int off, int len) throws IgniteCheckedException
- Specified by:
putValuein interfaceCacheObject- Parameters:
buf- Buffer to write value to.off- Offset in source binary data.len- Length of the data to write.- Returns:
Trueif value was successfully written,falseif there was not enough space in the buffer.- Throws:
IgniteCheckedException- If failed.
-
valueBytesLength
public int valueBytesLength(CacheObjectContext ctx) throws IgniteCheckedException
- Specified by:
valueBytesLengthin interfaceCacheObject- Parameters:
ctx- Cache object context.- Returns:
- Size required to store this value object.
- Throws:
IgniteCheckedException- If failed.
-
cacheObjectType
public byte cacheObjectType()
- Specified by:
cacheObjectTypein interfaceCacheObject- Returns:
- Object type.
-
isPlatformType
public boolean isPlatformType()
Gets flag indicating whether object value is a platform type. Platform types will be automatically deserialized on public API cache operations regardless whetherIgniteCache.withKeepBinary()is used or not.- Specified by:
isPlatformTypein interfaceCacheObject- Returns:
- Platform type flag.
-
prepareForCache
public CacheObject prepareForCache(CacheObjectContext ctx)
Prepares cache object for cache (e.g. copies user-provided object if needed).- Specified by:
prepareForCachein interfaceCacheObject- Parameters:
ctx- Cache context.- Returns:
- Instance to store in cache.
-
prepareMarshal
public void prepareMarshal(CacheObjectValueContext ctx) throws IgniteCheckedException
- Specified by:
prepareMarshalin interfaceCacheObject- Parameters:
ctx- Context.- Throws:
IgniteCheckedException- If failed.
-
onAckReceived
public void onAckReceived()
Method called when ack message received.- Specified by:
onAckReceivedin interfaceMessage
-
writeTo
public boolean writeTo(ByteBuffer buf, MessageWriter writer)
Writes this message to provided byte buffer.
-
readFrom
public boolean readFrom(ByteBuffer buf, MessageReader reader)
Reads this message from provided byte buffer.
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
directType
public short directType()
Gets message type.- Specified by:
directTypein interfaceMessage- Returns:
- Message type.
-
fieldsCount
public byte fieldsCount()
Gets fields count.- Specified by:
fieldsCountin interfaceMessage- Returns:
- Fields count.
-
-