saker.build Documentation TaskDoc JavaDoc
public class RMITreeMapWrapper implements RMIWrapper
RMIWrapper implementation that writes a Map instance and reads them as TreeMap instances.

The keys and values are written using RMIObjectOutput.writeObject(Object).

Constructors
public
Creates a new instance.
public
Creates a new instance for a map.
Methods
public Object
Gets the wrapped object which should be serialized during RMI transfer.
public void
Reads the wrapped object from the RMI object input stream.
public Object
Resolves the wrapped object during deserialization.
public void
Writes the wrapped object to the RMI object output stream.
Creates a new instance.

Users shouldn't instantiate this class manually, but leave that to the RMI runtime.

public RMITreeMapWrapper(Map<?, ?> map)
Creates a new instance for a map.

Users shouldn't instantiate this class manually, but leave that to the RMI runtime.

mapThe map.
Overridden from: RMIWrapper
Gets the wrapped object which should be serialized during RMI transfer.

If RMIWrapper.resolveWrapped() returned this then this method will be called when the wrapper instance is serialized to an other endpoint. It is preferred to return a remote proxy to the previously wrapped object to pass back to the original endpoint when reverse request is made. Returning this from this method will result in the serialization of this wrapper through RMI.

If RMIWrapper.resolveWrapped() did not return this then this method can freely return null or throw exceptions (e.g. UnsupportedOperationException) because it will never be called.

The object to serialize instead of this.
Overridden from: RMIWrapper
Reads the wrapped object from the RMI object input stream.
inThe input stream to read from.
IOExceptionIn case of I/O error.
ClassNotFoundExceptionIf a class for a serialized object cannot be found.
Overridden from: RMIWrapper
Resolves the wrapped object during deserialization.

The result of this method will be returned to the caller, or used during the RMI request.

The result of the object transfer.
public void writeWrapped(RMIObjectOutput out) throws IOException
Overridden from: RMIWrapper
Writes the wrapped object to the RMI object output stream.

Important aspect of writing objects using wrappers is that in this method if any of the object writing method is called, then the non customizable aspects of the serializable will not be applied to the object that is being wrapped.

E.g. If an RMIWrapper is defined for an object type T, then calling RMIObjectOutput.writeRemoteObject(Object) will not cause the subject object with the type T to be written using an RMIWrapper again, but it will be actually written as a remote object.

outThe output stream to write to.
IOExceptionIn case of I/O error.