Interface Serializer
public interface Serializer
Supports writing and reading of object instances to/from a pipe.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault Serializer
Adapts this serializer to conform to the given descriptor or else returns this instance if no adaptation is required.default Object
Returns an opaque serializable object describing the encoding format.Reads an object from the pipe.static Serializer
Generates and returns a serializer for a record type, an enum type, or a simple class.default void
Skip an object instead of reading it.Returns a non-null set of classes.void
Writes a non-null object to the pipe.
-
Method Details
-
simple
Generates and returns a serializer for a record type, an enum type, or a simple class. A simple class must have a public no-arg constructor, and only public fields are serialized. Static and transient fields aren't serialized either.- Throws:
IllegalArgumentException
- if the given type isn't supported
-
supportedTypes
-
write
Writes a non-null object to the pipe.- Throws:
IOException
-
read
Reads an object from the pipe. The returned object can be null.- Throws:
IOException
-
skip
Skip an object instead of reading it. By default, the read method is called.- Parameters:
remoteConsumer
- receives all client-side remote objects, which aren't truly skipped; can pass null to do nothing with them- Throws:
IOException
-
descriptor
Returns an opaque serializable object describing the encoding format. The descriptor type itself can only depend on built-in serializers and is typically a string. -
adapt
Adapts this serializer to conform to the given descriptor or else returns this instance if no adaptation is required. If adaptation isn't possible, can return null to specify a serializer which always reads and writes null, thus discarding the object entirely.- Parameters:
descriptor
- an object which was provided by thedescriptor()
method
-