Class OStreamSerializerSBTreeIndexRIDContainer
java.lang.Object
com.orientechnologies.orient.core.serialization.serializer.stream.OStreamSerializerSBTreeIndexRIDContainer
- All Implemented Interfaces:
OBinarySerializer<OIndexRIDContainer>
public class OStreamSerializerSBTreeIndexRIDContainer
extends Object
implements OBinarySerializer<OIndexRIDContainer>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final OBooleanSerializerstatic final intstatic final intstatic final intstatic final intstatic final intstatic final bytestatic final OStreamSerializerSBTreeIndexRIDContainerstatic final OIntegerSerializerstatic final OLinkSerializerstatic final OLongSerializerstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(byte[] stream, int startPosition) Reads object from the stream starting from the startPositionConverts binary presentation of object to object instance.deserializeFromByteBufferObject(ByteBuffer buffer, OWALChanges walChanges, int offset) Converts binary presentation of object to object instance taking in account changes which are done inside of atomic operationOAtomicOperation.deserializeNativeObject(byte[] stream, int offset) Reads object from the stream starting from the startPosition, in case there were serialized usingOBinarySerializer.serializeNativeObject(T, byte[], int, Object...)method.intbytegetId()intgetObjectSize(byte[] stream, int startPosition) Return size serialized presentation of given object.intgetObjectSize(OIndexRIDContainer object, Object... hints) Obtain size of the serialized object Size is the amount of bites that required for storing object (for example: for storing integer we need 4 bytes)intgetObjectSizeInByteBuffer(ByteBuffer buffer) Returns amount of bytes which is consumed by object which is already serialized in buffer.intgetObjectSizeInByteBuffer(ByteBuffer buffer, OWALChanges walChanges, int offset) Returns amount of bytes which is consumed by object which is already serialized in buffer taking in account changes which are done inside of atomic operationOAtomicOperation.intgetObjectSizeNative(byte[] stream, int startPosition) Return size serialized presentation of given object, if it was serialized usingOBinarySerializer.serializeNativeObject(T, byte[], int, Object...)method.booleanpreprocess(OIndexRIDContainer value, Object... hints) voidserialize(OIndexRIDContainer object, byte[] stream, int startPosition, Object... hints) Writes object to the stream starting from the startPositionvoidserializeInByteBufferObject(OIndexRIDContainer object, ByteBuffer buffer, Object... hints) Serializes binary presentation of object toByteBuffer.voidserializeNativeObject(OIndexRIDContainer object, byte[] stream, int offset, Object... hints) Writes object to the stream starting from the startPosition using native acceleration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.orientechnologies.common.serialization.types.OBinarySerializer
serializeNativeAsWhole
-
Field Details
-
INSTANCE
-
ID
public static final byte ID- See Also:
-
FILE_ID_OFFSET
public static final int FILE_ID_OFFSET- See Also:
-
EMBEDDED_OFFSET
public static final int EMBEDDED_OFFSET- See Also:
-
DURABLE_OFFSET
public static final int DURABLE_OFFSET- See Also:
-
SBTREE_ROOTINDEX_OFFSET
public static final int SBTREE_ROOTINDEX_OFFSET- See Also:
-
SBTREE_ROOTOFFSET_OFFSET
public static final int SBTREE_ROOTOFFSET_OFFSET- See Also:
-
EMBEDDED_SIZE_OFFSET
public static final int EMBEDDED_SIZE_OFFSET- See Also:
-
EMBEDDED_VALUES_OFFSET
public static final int EMBEDDED_VALUES_OFFSET- See Also:
-
LONG_SERIALIZER
-
BOOLEAN_SERIALIZER
-
INT_SERIALIZER
-
SBTREE_CONTAINER_SIZE
public static final int SBTREE_CONTAINER_SIZE- See Also:
-
LINK_SERIALIZER
-
-
Constructor Details
-
OStreamSerializerSBTreeIndexRIDContainer
public OStreamSerializerSBTreeIndexRIDContainer()
-
-
Method Details
-
getObjectSize
Description copied from interface:OBinarySerializerObtain size of the serialized object Size is the amount of bites that required for storing object (for example: for storing integer we need 4 bytes)- Specified by:
getObjectSizein interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
object- is the object to measure its sizehints- List of parameters which may be used to choose appropriate serialization approach.- Returns:
- size of the serialized object
-
getObjectSize
public int getObjectSize(byte[] stream, int startPosition) Description copied from interface:OBinarySerializerReturn size serialized presentation of given object.- Specified by:
getObjectSizein interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
stream- Serialized content.startPosition- Position from which serialized presentation of given object is stored.- Returns:
- Size serialized presentation of given object in bytes.
-
serialize
Description copied from interface:OBinarySerializerWrites object to the stream starting from the startPosition- Specified by:
serializein interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
object- is the object to serializestream- is the stream where object will be writtenhints- List of parameters which may be used to choose appropriate serialization approach.
-
deserialize
Description copied from interface:OBinarySerializerReads object from the stream starting from the startPosition- Specified by:
deserializein interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
stream- is the stream from object will be readstartPosition- is the position to start reading from- Returns:
- instance of the deserialized object
-
getId
public byte getId()- Specified by:
getIdin interfaceOBinarySerializer<OIndexRIDContainer>- Returns:
- Identifier of given serializer.
-
isFixedLength
public boolean isFixedLength()- Specified by:
isFixedLengthin interfaceOBinarySerializer<OIndexRIDContainer>- Returns:
trueif binary presentation of object always has the same length.
-
getFixedLength
public int getFixedLength()- Specified by:
getFixedLengthin interfaceOBinarySerializer<OIndexRIDContainer>- Returns:
- Length of serialized data if
OBinarySerializer.isFixedLength()method returnstrue. IfOBinarySerializer.isFixedLength()method returnfalsereturned value is undefined.
-
serializeNativeObject
public void serializeNativeObject(OIndexRIDContainer object, byte[] stream, int offset, Object... hints) Description copied from interface:OBinarySerializerWrites object to the stream starting from the startPosition using native acceleration. Serialized object presentation is platform dependant.- Specified by:
serializeNativeObjectin interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
object- is the object to serializestream- is the stream where object will be writtenhints- List of parameters which may be used to choose appropriate serialization approach.
-
deserializeNativeObject
Description copied from interface:OBinarySerializerReads object from the stream starting from the startPosition, in case there were serialized usingOBinarySerializer.serializeNativeObject(T, byte[], int, Object...)method.- Specified by:
deserializeNativeObjectin interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
stream- is the stream from object will be readoffset- is the position to start reading from- Returns:
- instance of the deserialized object
-
getObjectSizeNative
public int getObjectSizeNative(byte[] stream, int startPosition) Description copied from interface:OBinarySerializerReturn size serialized presentation of given object, if it was serialized usingOBinarySerializer.serializeNativeObject(T, byte[], int, Object...)method.- Specified by:
getObjectSizeNativein interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
stream- Serialized content.startPosition- Position from which serialized presentation of given object is stored.- Returns:
- Size serialized presentation of given object in bytes.
-
preprocess
- Specified by:
preprocessin interfaceOBinarySerializer<OIndexRIDContainer>
-
serializeInByteBufferObject
public void serializeInByteBufferObject(OIndexRIDContainer object, ByteBuffer buffer, Object... hints) Serializes binary presentation of object toByteBuffer. Position of buffer should be set before calling of given method. Serialization result is compatible with result of call ofOBinarySerializer.serializeNativeObject(Object, byte[], int, Object...)method. So if we call:buffer.position(10); binarySerializer.serializeInByteBufferObject(object, buffer);and thenbyte[] stream = new byte[serializedSize + 10]; buffer.position(10); buffer.get(stream);following assert should passassert object.equals(binarySerializer.deserializeNativeObject(stream, 10))Final position ofByteBufferwill be changed and will be equal to sum of buffer start position and value returned by methodOBinarySerializer.getObjectSize(Object, Object...)- Specified by:
serializeInByteBufferObjectin interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
object- Object to serialize.buffer- Buffer which will contain serialized presentation of buffer.hints- Type (types in case of composite object) of object.
-
deserializeFromByteBufferObject
Converts binary presentation of object to object instance. Position of buffer should be set before call of this method. Binary format of method is expected to be the same as binary format ofOBinarySerializer.serializeNativeObject(Object, byte[], int, Object...)So if we callbyte[] stream = new byte[serializedSize]; binarySerializer.serializeNativeObject(object, stream, 0);following assert should passbyteBuffer.position(10); byteBuffer.put(stream); byteBuffer.position(10); assert object.equals(binarySerializer.deserializeFromByteBufferObject(buffer))Final position ofByteBufferwill be changed and will be equal to sum of buffer start position and value returned by methodOBinarySerializer.getObjectSize(Object, Object...)- Specified by:
deserializeFromByteBufferObjectin interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
buffer- Buffer which contains serialized presentation of object- Returns:
- Instance of object serialized in buffer.
-
getObjectSizeInByteBuffer
Returns amount of bytes which is consumed by object which is already serialized in buffer. Position of buffer should be set before call of this method. Result of call should be the same as result of call ofOBinarySerializer.getObjectSize(Object, Object...)on deserialized object.- Specified by:
getObjectSizeInByteBufferin interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
buffer- Buffer which contains serialized version of object- Returns:
- Size of serialized object.
-
deserializeFromByteBufferObject
public OIndexRIDContainer deserializeFromByteBufferObject(ByteBuffer buffer, OWALChanges walChanges, int offset) Converts binary presentation of object to object instance taking in account changes which are done inside of atomic operationOAtomicOperation. Binary format of method is expected to be the same as binary format of methodOBinarySerializer.serializeNativeObject(Object, byte[], int, Object...). So if we call:byte[] stream = new byte[serializedSize]; binarySerializer.serializeNativeObject(object, stream, 0); walChanges.setBinaryValue(buffer, stream, 10);Then following assert should passassert object.equals(binarySerializer.deserializeFromByteBufferObject(buffer, walChanges, 10));- Specified by:
deserializeFromByteBufferObjectin interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
buffer- Buffer which will contain serialized changes.walChanges- Changes are done during atomic operation.offset- Offset of binary presentation of object inside of byte buffer/atomic operations changes.- Returns:
- Instance of object serialized in buffer.
-
getObjectSizeInByteBuffer
Returns amount of bytes which is consumed by object which is already serialized in buffer taking in account changes which are done inside of atomic operationOAtomicOperation. Result of call should be the same as result of call ofOBinarySerializer.getObjectSize(Object, Object...)on deserialized object.- Specified by:
getObjectSizeInByteBufferin interfaceOBinarySerializer<OIndexRIDContainer>- Parameters:
buffer- Buffer which will contain serialized changes.walChanges- Changes are done during atomic operation.offset- Offset of binary presentation of object inside of byte buffer/atomic operations changes.- Returns:
- Size of serialized object.
-