This wrapper will query the length of the transferred ByteRegion, and write that alongside the remote region object. When it is deserialized, an instance of this wrapper will take place of the transferred object.
The purpose of this wrapper is to spare the remote method call cost of getLength(). As that is a very commonly called method, using this wrapper can increase performance.
The target type for this wrapper should be ByteRegion.
public | Creates a new instance. |
public | RMIByteRegionWrapper( Creates a new instance for the given region. |
public byte[] | copy() Copies underlying contents of this byte region and returns it as a byte array. |
public byte[] | copyArrayRegion( Copies contents from a subregion of this byte region and returns it as an array. |
public byte | get( Gets the byte at the specified index. |
public int | Gets the length of this byte region. |
public Object | Gets the wrapped object which should be serialized during RMI transfer. |
public void | put( Puts a byte into the region at the given index. |
public void | put( Puts the given bytes into the byte region starting at the given offset. |
public void | Reads the wrapped object from the RMI object input stream. |
public Object | Resolves the wrapped object during deserialization. |
public String | toString() Returns a string representation of the object. |
public void | Writes the wrapped object to the RMI object output stream. |
Users shouldn't instantiate this class manually, but leave that to the RMI runtime.
Users shouldn't instantiate this class manually, but leave that to the RMI runtime.
null
.Modifying the returned array will have no effect on the contents of this byte region.
Modifying the returned array will have no effect on the contents of this byte region.
The length of a region doesn't change over the lifetime of an object.
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.
this
.
This method is the same as calling ByteRegion.put(
The result of this method will be returned to the caller, or used during the RMI request.
toString
method returns a string that
"textually represents" this object. The result should be a concise but informative representation that is easy
for a person to read. It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of
which the object is an instance, the at-sign character `@
', and the unsigned hexadecimal representation
of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
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(