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 TypeFieldDescriptionint
long
int
-
Constructor Summary
ConstructorsConstructorDescriptionSerializer
(ITypeIdProvider customTypeIdProvider, OutputStream stream, boolean generateStringPool) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addProgressCallback
(IProgressCallback callback) void
close()
void
debugEnable
(boolean enableObjectCounting, boolean enableObjectStoring, boolean enableTypeIdStoring) void
debugEnableWrittenStringPool
(boolean enable) <C> List<C>
debugGetObjectStores
(Class<C> clazz) long
Retrieve the number of bytes (may be approximate) generated by the last call made toserialize(Object)
.int
Retrieve the number of serialized or partially serialized objects.int
int
long
int
void
removeProgressCallback
(IProgressCallback callback) void
void
setCustomSerializationClassFlags
(Class<?> c, int flags) void
setExpectedObjectCount
(int count) void
setup
(boolean simulation) void
void
writeFields
(Object o, Class<?> targetClass)
-
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:
getStream
in 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 insimulation
mode
-
getStringPool
-
serialize
- Throws:
IOException
-
close
- Throws:
IOException
-
write
- Specified by:
write
in interfaceIInternalSerializer
- Throws:
IOException
-
writeFields
- Specified by:
writeFields
in interfaceIInternalSerializer
- 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
-