Top Inners Fields Constructors Methods
io.vertx.core.eventbus.impl.codecs

public Class SerializableCodec

extends Object
implements MessageCodec<Object, Object>
Class Inheritance
All Implemented Interfaces
io.vertx.core.eventbus.MessageCodec
Imports
io.vertx.core.buffer.Buffer, io.vertx.core.eventbus.MessageCodec, io.vertx.core.eventbus.impl.CodecManager, java.io.*

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final CodecManager

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
decodeFromWire(int
the position in the buffer where the message should be read from.
pos
,
Buffer
the buffer to read the message from
buffer
)

Implements io.vertx.core.eventbus.MessageCodec.decodeFromWire.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Called by Vert.x when a message is decoded from the wire.

public void
encodeToWire(Buffer
the message should be written into this buffer
buffer
,
Object
the message that is being sent
o
)

Implements io.vertx.core.eventbus.MessageCodec.encodeToWire.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Called by Vert.x when marshalling a message to the wire.

public String
name()

Implements io.vertx.core.eventbus.MessageCodec.name.

The codec name.

public byte
systemCodecID()

Implements io.vertx.core.eventbus.MessageCodec.systemCodecID.

Used to identify system codecs.

public Object
transform(Object
the sent message
o
)

Implements io.vertx.core.eventbus.MessageCodec.transform.

If a message is sent locally across the event bus, this method is called to transform the message from the sent type S to the received type R

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

codecManagerback to summary
private final CodecManager codecManager

Constructor Detail

SerializableCodecback to summary
public SerializableCodec(CodecManager codecManager)

Method Detail

decodeFromWireback to summary
public Object decodeFromWire(int pos, Buffer buffer)

Implements io.vertx.core.eventbus.MessageCodec.decodeFromWire.

Doc from io.vertx.core.eventbus.MessageCodec.decodeFromWire.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Called by Vert.x when a message is decoded from the wire.

Parameters
pos:int

the position in the buffer where the message should be read from.

buffer:Buffer

the buffer to read the message from

Returns:Object

the read message

Annotations
@Override
encodeToWireback to summary
public void encodeToWire(Buffer buffer, Object o)

Implements io.vertx.core.eventbus.MessageCodec.encodeToWire.

Doc from io.vertx.core.eventbus.MessageCodec.encodeToWire.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Called by Vert.x when marshalling a message to the wire.

Parameters
buffer:Buffer

the message should be written into this buffer

o:Object

the message that is being sent

Annotations
@Override
nameback to summary
public String name()

Implements io.vertx.core.eventbus.MessageCodec.name.

Doc from io.vertx.core.eventbus.MessageCodec.name.

The codec name. Each codec must have a unique name. This is used to identify a codec when sending a message and for unregistering codecs.

Returns:String

the name

Annotations
@Override
systemCodecIDback to summary
public byte systemCodecID()

Implements io.vertx.core.eventbus.MessageCodec.systemCodecID.

Doc from io.vertx.core.eventbus.MessageCodec.systemCodecID.

Used to identify system codecs. Should always return -1 for a user codec.

Returns:byte

-1 for a user codec.

Annotations
@Override
transformback to summary
public Object transform(Object o)

Implements io.vertx.core.eventbus.MessageCodec.transform.

Doc from io.vertx.core.eventbus.MessageCodec.transform.

If a message is sent locally across the event bus, this method is called to transform the message from the sent type S to the received type R

Parameters
o:Object

the sent message

Returns:Object

the transformed message

Annotations
@Override
io.vertx.core.eventbus.impl.codecs back to summary

private Class SerializableCodec.CheckedClassNameObjectInputStream

extends ObjectInputStream
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected Class<?>
resolveClass(ObjectStreamClass
an instance of class ObjectStreamClass
desc
)

Overrides java.io.ObjectInputStream.resolveClass.

Load the local class equivalent of the specified stream class description.

Inherited from java.io.ObjectInputStream:
availableclosedefaultReadObjectenableResolveObjectgetObjectInputFilterreadreadreadBooleanreadBytereadCharreadClassDescriptorreadDoublereadFieldsreadFloatreadFullyreadFullyreadIntreadLinereadLongreadObjectreadObjectOverridereadShortreadStreamHeaderreadUnsharedreadUnsignedBytereadUnsignedShortreadUTFregisterValidationresolveObjectresolveProxyClasssetObjectInputFilterskipBytes

Constructor Detail

CheckedClassNameObjectInputStreamback to summary
pack-priv CheckedClassNameObjectInputStream(InputStream in) throws IOException

Method Detail

resolveClassback to summary
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException

Overrides java.io.ObjectInputStream.resolveClass.

Doc from java.io.ObjectInputStream.resolveClass.

Load the local class equivalent of the specified stream class description. Subclasses may implement this method to allow classes to be fetched from an alternate source.

The corresponding method in ObjectOutputStream is annotateClass. This method will be invoked only once for each unique class in the stream. This method can be implemented by subclasses to use an alternate loading mechanism but must return a Class object. Once returned, if the class is not an array class, its serialVersionUID is compared to the serialVersionUID of the serialized class, and if there is a mismatch, the deserialization fails and an InvalidClassException is thrown.

The default implementation of this method in ObjectInputStream returns the result of calling

Class.forName(desc.getName(), false, loader)
Class.forName(desc.getName(), false, loader)
where loader is the first class loader on the current thread's stack (starting from the currently executing method) that is neither the platform class loader nor its ancestor; otherwise, loader is the platform class loader. If this call results in a ClassNotFoundException and the name of the passed ObjectStreamClass instance is the Java language keyword for a primitive type or void, then the Class object representing that primitive type or void will be returned (e.g., an ObjectStreamClass with the name "int" will be resolved to Integer.TYPE). Otherwise, the ClassNotFoundException will be thrown to the caller of this method.
Parameters
desc:ObjectStreamClass

an instance of class ObjectStreamClass

Returns:Class<?>

a Class object corresponding to desc

Annotations
@Override
Exceptions
IOException:
any of the usual Input/Output exceptions.
ClassNotFoundException:
if class of a serialized object cannot be found.