Class Channel.Config
java.lang.Object
org.apidesign.jvm.channel.Channel.Config
- Enclosing class:
Channel<Data extends Channel.Config>
Set of methods necessary for construction of a
Channel.
Subclasses must have a public default constructor accessible via
reflection from the Channel.create(JVM, Class) method.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConfig()Subclasses must havepublicdefault constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract Objectread(ByteBuffer buf) Deserializes bytes of a message into an object representing them.abstract voidwrite(Object obj, ByteBuffer buf) Configuration must be capable to serialize messages sent to the channel intobyte[].
-
Constructor Details
-
Config
protected Config()Subclasses must havepublicdefault constructor.
-
-
Method Details
-
write
Configuration must be capable to serialize messages sent to the channel intobyte[]. The sibling functionread(ByteBuffer)must then be capable to reconstruct the object back.- Parameters:
obj- the object with the message to transferbuf- buffer to put the serialized form representing the provided object into- Throws:
IOException- if the conversion goes wrongBufferOverflowException- when theBuffer.limit()is reached and needs to be increased- See Also:
-
read
Deserializes bytes of a message into an object representing them. Operates in reverse towrite(Object, ByteBuffer)function.- Parameters:
buf- the buffer with stored data- Returns:
- object representing the message stored in the buffer
- Throws:
IOException- if the conversion fails for some reason
-