Interface Serializer<T>
- Type Parameters:
T- the target type of this serializer.
- All Known Implementing Classes:
AddressSerializer,EmbeddedCacheManagerGroupMemberSerializer,JChannelGroupMemberSerializer,JGroupsAddressSerializer,KeySerializer,LocalAddressSerializer,Serializer.Provided,UUIDSerializer
public interface Serializer<T>
Writes/reads an object to/from a binary stream.
- Author:
- Paul Ferraro
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Serializer<T> of(T value) Reads an object from the specified input stream.default OptionalIntReturns the size of the buffer to use for marshalling the specified object, if known.toFormatter(Class<? extends T> type) Creates aFormatterbased on this serializer.default <V> Serializer<V> Creates a wrapped serializer that delegates to this serializer applying the specified wrapping/unwrapping functions.voidwrite(DataOutput output, T value) Writes the specified object to the specified output stream
-
Method Details
-
write
Writes the specified object to the specified output stream- Parameters:
output- the data output streamvalue- an object to serialize- Throws:
IOException- if an I/O error occurs
-
read
Reads an object from the specified input stream.- Parameters:
input- a data input stream- Returns:
- the deserialized object
- Throws:
IOException- if an I/O error occurs
-
size
Returns the size of the buffer to use for marshalling the specified object, if known.- Parameters:
object- the object to be sized- Returns:
- the buffer size (in bytes), or empty if unknown.
-
wrap
Creates a wrapped serializer that delegates to this serializer applying the specified wrapping/unwrapping functions.- Type Parameters:
V- the wrapper type- Parameters:
unwrapper- an unwrapping functionwrapper- a wrapping function- Returns:
- a wrapped serializer
-
toFormatter
-
of
-