Class CacheObjectUtils
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.CacheObjectUtils
-
public class CacheObjectUtils extends Object
Cache object utility methods.
-
-
Field Summary
Fields Modifier and Type Field Description protected static intHEAD_SIZEHead size.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intobjectPutSize(int dataLen)static booleanputValue(byte cacheObjType, ByteBuffer buf, int off, int len, byte[] valBytes, int start)static Collection<Object>unwrapBinariesIfNeeded(CacheObjectValueContext ctx, Collection<?> col, boolean keepBinary)static ObjectunwrapBinary(CacheObjectValueContext ctx, Object o, boolean keepBinary, boolean cpy, @Nullable ClassLoader ldr)Unwraps an object for end user.static ObjectunwrapBinaryIfNeeded(CacheObjectValueContext ctx, Object o, boolean keepBinary, boolean cpy, @Nullable ClassLoader ldr)static ObjectunwrapBinaryIfNeeded(CacheObjectValueContext ctx, CacheObject o, boolean keepBinary, boolean cpy)
-
-
-
Field Detail
-
HEAD_SIZE
protected static final int HEAD_SIZE
Head size.- See Also:
- Constant Field Values
-
-
Method Detail
-
unwrapBinaryIfNeeded
public static Object unwrapBinaryIfNeeded(CacheObjectValueContext ctx, CacheObject o, boolean keepBinary, boolean cpy)
- Parameters:
o- Object to unwrap.keepBinary- Keep binary flag.cpy- Copy value flag.- Returns:
- Unwrapped object.
-
unwrapBinaryIfNeeded
public static Object unwrapBinaryIfNeeded(CacheObjectValueContext ctx, Object o, boolean keepBinary, boolean cpy, @Nullable @Nullable ClassLoader ldr)
- Parameters:
ctx- Cache object context.o- Object to unwrap.keepBinary- Keep binary flag.cpy- Copy value flag.ldr- Class loader, used for deserialization from binary representation.- Returns:
- Unwrapped object.
-
unwrapBinariesIfNeeded
public static Collection<Object> unwrapBinariesIfNeeded(CacheObjectValueContext ctx, Collection<?> col, boolean keepBinary)
- Parameters:
col- Collection of objects to unwrap.keepBinary- Keep binary flag.- Returns:
- Unwrapped collection.
-
unwrapBinary
public static Object unwrapBinary(CacheObjectValueContext ctx, Object o, boolean keepBinary, boolean cpy, @Nullable @Nullable ClassLoader ldr)
Unwraps an object for end user.- Parameters:
ctx- Cache object context.o- Object to unwrap.keepBinary- False when need to deserialize object from a binary one, true otherwise.cpy- True means the object will be copied before return, false otherwise.ldr- Class loader, used for deserialization from binary representation.- Returns:
- Unwrapped object.
-
objectPutSize
public static int objectPutSize(int dataLen)
- Parameters:
dataLen- Serialized value length.- Returns:
- Full size required to store cache object.
- See Also:
putValue(byte, ByteBuffer, int, int, byte[], int)
-
putValue
public static boolean putValue(byte cacheObjType, ByteBuffer buf, int off, int len, byte[] valBytes, int start) throws IgniteCheckedException- Parameters:
cacheObjType- Cache object type.buf- Buffer to write value to.off- Offset in source binary data.len- Length of the data to write.valBytes- Binary data.start- Start offset in binary data.- Returns:
Trueif data were successfully written.- Throws:
IgniteCheckedException- If failed.
-
-