public final class SerializationUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
expect(Class<T> expected,
ObjectInputStream ois,
SubProgressObserver spo)
Deserialize an expected type.
|
static <T extends Serializable> |
writePlain(T o,
long wu,
ObjectOutputStream oos)
Serialize with
Deserializer API contracts using standard Java serialization. |
static <T extends Serializable> |
writePlain(T o,
long wu,
ObjectOutputStream oos,
SubProgressObserver po)
Serialize with
Deserializer API contracts using standard Java serialization. |
public static <T> T expect(Class<T> expected, ObjectInputStream ois, SubProgressObserver spo) throws IOException, ClassNotFoundException
Deserializer
is read first from the stream. The read instance queried to check
against the expected type. Deserialization is delegated to the read Deserializer
.T
- Type expectedexpected
- Type expectedois
- Stream to read fromspo
- Observer to track progress. Method ProgressObserver.done()
will be invoked when completed
or in case of errorIOException
- Propagated from deserializationClassNotFoundException
- Propagated from deserializationIllegalStateException
- When the deserialized type does not matchpublic static <T extends Serializable> void writePlain(T o, long wu, ObjectOutputStream oos) throws IOException
Deserializer
API contracts using standard Java serialization.T
- Type of object to serializeo
- Object to serializewu
- Number of completed working units to report by the Deserializer
oos
- Stream to write to; will not be closed by this methodIOException
- Propagated from serializationpublic static <T extends Serializable> void writePlain(T o, long wu, ObjectOutputStream oos, SubProgressObserver po) throws IOException
Deserializer
API contracts using standard Java serialization.T
- Type of object to serializeo
- Object to serializewu
- Number of completed working units to report by the Deserializer
oos
- Stream to write to; will not be closed by this methodpo
- Observer to track progress. Will be closed upon completion.IOException
- Propagated from serialization