Class Serializer
java.lang.Object
com.pnfsoftware.jeb.util.serialization.Serializer
- All Implemented Interfaces:
IInternalSerializer
This class allows the serialization of object(s) to a stream of bytes.
The serialize(Object) method is interruptible.
-
Field Summary
FieldsModifier and TypeFieldDescriptionintlongint -
Constructor Summary
ConstructorsConstructorDescriptionSerializer(ITypeIdProvider customTypeIdProvider, OutputStream stream, boolean generateStringPool) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProgressCallback(IProgressCallback callback) voidclose()voiddebugEnable(boolean enableObjectCounting, boolean enableObjectStoring, boolean enableTypeIdStoring) voiddebugEnableWrittenStringPool(boolean enable) <C> List<C>debugGetObjectStores(Class<C> clazz) longRetrieve the number of bytes (may be approximate) generated by the last call made toserialize(Object).intRetrieve the number of serialized or partially serialized objects.intintlongintvoidremoveProgressCallback(IProgressCallback callback) voidvoidsetCustomSerializationClassFlags(Class<?> c, int flags) voidsetExpectedObjectCount(int count) voidsetup(boolean simulation) voidvoidwriteFields(Object o, Class<?> targetClass) voidwriteFields(Object o, Class<?> targetClass, Integer containerSerTypeId)
-
Field Details
-
dbgObjectCounts
-
dbgObjectStores
-
dbgTypeIds
-
writtenStringCount
public int writtenStringCount -
writtenStringBytesCount
public long writtenStringBytesCount -
writtenStringPool
-
collectionSizes
-
deferredCount
public int deferredCount
-
-
Constructor Details
-
Serializer
public Serializer(ITypeIdProvider customTypeIdProvider, OutputStream stream, boolean generateStringPool)
-
-
Method Details
-
setup
public void setup(boolean simulation) -
getStream
- Specified by:
getStreamin interfaceIInternalSerializer
-
getRootCount
public int getRootCount() -
getObjectCount
public int getObjectCount()Retrieve the number of serialized or partially serialized objects.CAREFUL! the number of objects fully serialized (entirely written to the stream) is less than or equal to that number. Use
getWrittenObjectCount()to get it.- Returns:
-
getWrittenObjectCount
public int getWrittenObjectCount() -
getLastWrittenSize
public long getLastWrittenSize()Retrieve the number of bytes (may be approximate) generated by the last call made toserialize(Object).- Returns:
- a number of bytes, possibly an approximation if the last call to
serialize(Object)was made insimulationmode
-
getStringPool
-
serialize
- Throws:
IOException
-
close
- Throws:
IOException
-
write
- Specified by:
writein interfaceIInternalSerializer- Throws:
IOException
-
writeFields
- Specified by:
writeFieldsin interfaceIInternalSerializer- Throws:
IOException
-
writeFields
public void writeFields(Object o, Class<?> targetClass, Integer containerSerTypeId) throws IOException - Throws:
IOException
-
setExpectedObjectCount
public void setExpectedObjectCount(int count) -
addProgressCallback
-
removeProgressCallback
-
setCustomSerializationClassFlags
-
debugEnable
public void debugEnable(boolean enableObjectCounting, boolean enableObjectStoring, boolean enableTypeIdStoring) -
debugGetObjectCounts
-
debugGetObjectStores
-
debugGetObjectStores
-
debugGetTypeIds
-
getWrittenStringCount
public int getWrittenStringCount() -
getWrittenStringBytesCount
public long getWrittenStringBytesCount() -
debugEnableWrittenStringPool
public void debugEnableWrittenStringPool(boolean enable) -
getWrittenStringPool
-