Package org.rostore.mapper
Class BinaryMapper
java.lang.Object
org.rostore.mapper.BinaryMapper
A class to serialize and deserialize java classes to the binary stream.
It uses some properties of the rostore, e.g. the binary length of block indexes or block offset.
Depending on the parameters of the storage it can vary.
Use BlockIndex annotation to mark fields that store the block index,
and BlockOffset that represents the offset within a block.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tdeserialize(MapperProperties mediaProperties, Type type, InputStream inputStream) static <T> Tdeserialize(MapperProperties mapperProperties, Type type, InputStream inputStream, int limit) static intreadLength(InputStream data) static StringreadString(InputStream data) static <T> voidserialize(MapperProperties mediaProperties, T object, OutputStream outputStream) static <T> voidserialize(MapperProperties mediaProperties, T object, Type type, OutputStream outputStream) static voidwrite(OutputStream data, String value) static voidwriteLength(OutputStream data, int dataLength)
-
Constructor Details
-
BinaryMapper
public BinaryMapper()
-
-
Method Details
-
write
- Throws:
IOException
-
writeLength
- Throws:
IOException
-
readString
- Throws:
IOException
-
readLength
- Throws:
IOException
-
serialize
public static <T> void serialize(MapperProperties mediaProperties, T object, OutputStream outputStream) -
serialize
public static <T> void serialize(MapperProperties mediaProperties, T object, Type type, OutputStream outputStream) -
deserialize
public static <T> T deserialize(MapperProperties mediaProperties, Type type, InputStream inputStream) -
deserialize
public static <T> T deserialize(MapperProperties mapperProperties, Type type, InputStream inputStream, int limit) - Type Parameters:
T-- Parameters:
mapperProperties-type-inputStream-limit- it will stop after deserializing that many fields- Returns:
-