Package one.nio.serial
Class SerializedWrapper<T>
- java.lang.Object
-
- one.nio.serial.SerializedWrapper<T>
-
- All Implemented Interfaces:
java.io.Serializable
public class SerializedWrapper<T> extends java.lang.Object implements java.io.SerializableA wrapper for a preserialized object. Helps to avoid double serialization. The wrapper automatically unpacks the original object during deserialization.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]serialized
-
Constructor Summary
Constructors Constructor Description SerializedWrapper(byte[] serialized)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)byte[]getSerialized()inthashCode()Tunwrap()static <T> SerializedWrapper<T>wrap(T object)
-
-
-
Method Detail
-
getSerialized
public byte[] getSerialized()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
wrap
public static <T> SerializedWrapper<T> wrap(T object) throws java.io.IOException
- Throws:
java.io.IOException
-
unwrap
public T unwrap() throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-