
public class OLuceneMockSpatialSerializer extends Object implements OBinarySerializer<ODocument>
| Modifier and Type | Field and Description |
|---|---|
protected static OLuceneMockSpatialSerializer |
INSTANCE |
| Modifier | Constructor and Description |
|---|---|
protected |
OLuceneMockSpatialSerializer() |
| Modifier and Type | Method and Description |
|---|---|
ODocument |
deserialize(byte[] stream,
int startPosition)
Reads object from the stream starting from the startPosition
|
ODocument |
deserializeFromByteBufferObject(ByteBuffer buffer)
Converts binary presentation of object to object instance.
|
ODocument |
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 operation
OAtomicOperation. |
ODocument |
deserializeNativeObject(byte[] stream,
int startPosition)
Reads object from the stream starting from the startPosition, in case there were serialized
using
#serializeNativeObject(T, byte[], int, Object...) method. |
int |
getFixedLength() |
byte |
getId() |
int |
getObjectSize(byte[] stream,
int startPosition)
Return size serialized presentation of given object.
|
int |
getObjectSize(ODocument 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)
|
int |
getObjectSizeInByteBuffer(ByteBuffer buffer)
Returns amount of bytes which is consumed by object which is already serialized in buffer.
|
int |
getObjectSizeInByteBuffer(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 operation
OAtomicOperation. |
int |
getObjectSizeNative(byte[] stream,
int startPosition)
Return size serialized presentation of given object, if it was serialized using
#serializeNativeObject(T, byte[], int, Object...) method. |
boolean |
isFixedLength() |
ODocument |
preprocess(ODocument value,
Object... hints) |
void |
serialize(ODocument object,
byte[] stream,
int startPosition,
Object... hints)
Writes object to the stream starting from the startPosition
|
void |
serializeInByteBufferObject(ODocument object,
ByteBuffer buffer,
Object... hints)
Serializes binary presentation of object to
ByteBuffer. |
void |
serializeNativeObject(ODocument object,
byte[] stream,
int startPosition,
Object... hints)
Writes object to the stream starting from the startPosition using native acceleration.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitserializeNativeAsWholeprotected static OLuceneMockSpatialSerializer INSTANCE
public int getObjectSize(ODocument object, Object... hints)
OBinarySerializergetObjectSize in interface OBinarySerializer<ODocument>object - is the object to measure its sizehints - List of parameters which may be used to choose appropriate serialization approach.public int getObjectSize(byte[] stream,
int startPosition)
OBinarySerializergetObjectSize in interface OBinarySerializer<ODocument>stream - Serialized content.startPosition - Position from which serialized presentation of given object is stored.public void serialize(ODocument object, byte[] stream, int startPosition, Object... hints)
OBinarySerializerserialize in interface OBinarySerializer<ODocument>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.public ODocument deserialize(byte[] stream, int startPosition)
OBinarySerializerdeserialize in interface OBinarySerializer<ODocument>stream - is the stream from object will be readstartPosition - is the position to start reading frompublic byte getId()
getId in interface OBinarySerializer<ODocument>public boolean isFixedLength()
isFixedLength in interface OBinarySerializer<ODocument>true if binary presentation of object always has the same length.public int getFixedLength()
getFixedLength in interface OBinarySerializer<ODocument>OBinarySerializer.isFixedLength() method returns true.
If OBinarySerializer.isFixedLength() method return false returned value is undefined.public void serializeNativeObject(ODocument object, byte[] stream, int startPosition, Object... hints)
OBinarySerializerserializeNativeObject in interface OBinarySerializer<ODocument>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.public ODocument deserializeNativeObject(byte[] stream, int startPosition)
OBinarySerializer#serializeNativeObject(T, byte[], int, Object...) method.deserializeNativeObject in interface OBinarySerializer<ODocument>stream - is the stream from object will be readstartPosition - is the position to start reading frompublic int getObjectSizeNative(byte[] stream,
int startPosition)
OBinarySerializer#serializeNativeObject(T, byte[], int, Object...) method.getObjectSizeNative in interface OBinarySerializer<ODocument>stream - Serialized content.startPosition - Position from which serialized presentation of given object is stored.public ODocument preprocess(ODocument value, Object... hints)
preprocess in interface OBinarySerializer<ODocument>public void serializeInByteBufferObject(ODocument object, ByteBuffer buffer, Object... hints)
OBinarySerializerByteBuffer. Position of buffer should be
set before calling of given method. Serialization result is compatible with result of call of
OBinarySerializer.serializeNativeObject(Object, byte[], int, Object...) method. So if we call:
buffer.position(10);
binarySerializer.serializeInByteBufferObject(object, buffer);
and then
byte[] stream = new byte[serializedSize + 10];
buffer.position(10);
buffer.get(stream);
following assert should pass
assert object.equals(binarySerializer.deserializeNativeObject(stream, 10))
Final position of ByteBuffer will be changed and will be equal to sum of
buffer start position and value returned by method OBinarySerializer.getObjectSize(Object, Object...)serializeInByteBufferObject in interface OBinarySerializer<ODocument>object - Object to serialize.buffer - Buffer which will contain serialized presentation of buffer.hints - Type (types in case of composite object) of object.public ODocument deserializeFromByteBufferObject(ByteBuffer buffer)
OBinarySerializerOBinarySerializer.serializeNativeObject(Object, byte[], int, Object...) So if we call
byte[] stream = new byte[serializedSize];
binarySerializer.serializeNativeObject(object, stream, 0);
following assert should pass
byteBuffer.position(10);
byteBuffer.put(stream);
byteBuffer.position(10);
assert object.equals(binarySerializer.deserializeFromByteBufferObject(buffer))
Final position of ByteBuffer will be changed and will be equal to sum of
buffer start position and value returned by method OBinarySerializer.getObjectSize(Object, Object...)deserializeFromByteBufferObject in interface OBinarySerializer<ODocument>buffer - Buffer which contains serialized presentation of objectpublic int getObjectSizeInByteBuffer(ByteBuffer buffer)
OBinarySerializerOBinarySerializer.getObjectSize(Object, Object...) on deserialized object.getObjectSizeInByteBuffer in interface OBinarySerializer<ODocument>buffer - Buffer which contains serialized version of objectpublic ODocument deserializeFromByteBufferObject(ByteBuffer buffer, OWALChanges walChanges, int offset)
OBinarySerializerOAtomicOperation.
Binary format of method is expected to be the same as binary format of method OBinarySerializer.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 pass
assert object.equals(binarySerializer.deserializeFromByteBufferObject(buffer, walChanges, 10));
deserializeFromByteBufferObject in interface OBinarySerializer<ODocument>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.public int getObjectSizeInByteBuffer(ByteBuffer buffer, OWALChanges walChanges, int offset)
OBinarySerializerOAtomicOperation.
Result of call should be the same as result of call of OBinarySerializer.getObjectSize(Object,
Object...) on deserialized object.getObjectSizeInByteBuffer in interface OBinarySerializer<ODocument>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.Copyright © 2009–2025 OrientDB. All rights reserved.