public final class MemoryBuffer
extends java.lang.Object
implements java.io.Externalizable
The remote side will be responsible of converting instances of this class to a memptr
instance when it receives a MemoryBuffer
instance and also to send back to the
requester a MemoryBuffer
instance, in case OUTPUT or INPUT-OUTPUT mode is used for the
parameter.
Modifier and Type | Field and Description |
---|---|
private byte[] |
value
Stores the state of this instance as an array of bytes.
|
Constructor and Description |
---|
MemoryBuffer()
Default c'tor, needed for deserialization purposes; not for public use.
|
MemoryBuffer(byte[] value)
Construct a new instance of this class, by saving a copy of the passed byte array.
|
Modifier and Type | Method and Description |
---|---|
private byte[] |
getCopy(byte[] bytes)
Create a copy of the given array of bytes.
|
byte[] |
getValue()
Get the array of bytes for this instance, as a copy.
|
void |
readExternal(java.io.ObjectInput in)
Initialize this instance by reading its state from the specified stream.
|
void |
setValue(byte[] value)
Change the
array of bytes of this instance by saving a copy of the passed
array. |
void |
writeExternal(java.io.ObjectOutput out)
Write the state of this instance to the specified stream.
|
public MemoryBuffer()
public MemoryBuffer(byte[] value)
Any changes made to the passed array will not be reflected in this instance.
value
- The array of bytes representing the state of this instance.
May be null
.public void setValue(byte[] value)
array of bytes
of this instance by saving a copy of the passed
array.
Any changes made to the passed array will not be reflected in this instance.
value
- The array of bytes representing the new state of this instance.
May be null
.public byte[] getValue()
Any changes made to the returned array will not be reflected in this instance.
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
out
- The stream where the state of this instance will be sent.java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
in
- The stream from where the state of this instance will be read.java.io.IOException
java.lang.ClassNotFoundException
private byte[] getCopy(byte[] bytes)
bytes
- The array of bytes for which a copy is needed. May be null
.null
, return null
. Else,
return a copy of the array.