Transfer

The transfer class is used to send and receive Value objects. It is used on both the client side, and on the server side.

Methods
Transfer(SessionInterface session, Socket s)
Create a new transfer object for the specified session.
Transfer(SessionInterface session, Socket s)
Create a new transfer object for the specified session.
Parameters:
session - the session
s - the socket
void close()
Close the transfer object and the socket.
void close()
Close the transfer object and the socket.
void flush()
Write pending changes.
void flush() throws IOException
Write pending changes.
Socket getSocket()
Get the socket.
Socket getSocket()
Get the socket.
Returns:
the socket
void init()
Initialize the transfer object.
void init() throws IOException
Initialize the transfer object. This method will try to open an input and output stream.
boolean isClosed()
boolean isClosed()
Transfer openNewConnection()
Open a new new connection to the same address and port as this one.
Transfer openNewConnection() throws IOException
Open a new new connection to the same address and port as this one.
Returns:
the new transfer object
boolean readBoolean()
Read a boolean.
boolean readBoolean() throws IOException
Read a boolean.
Returns:
the value
byte[] readBytes()
Read a byte array.
byte[] readBytes() throws IOException
Read a byte array.
Returns:
the value
void readBytes(byte[] buff, int off, int len)
Read a number of bytes.
void readBytes(byte[] buff, int off, int len) throws IOException
Read a number of bytes.
Parameters:
buff - the target buffer
off - the offset
len - the number of bytes to read
int readInt()
Read an int.
int readInt() throws IOException
Read an int.
Returns:
the value
long readLong()
Read a long.
long readLong() throws IOException
Read a long.
Returns:
the value
String readString()
Read a string.
String readString() throws IOException
Read a string.
Returns:
the value
Value readValue()
Read a value.
Value readValue() throws IOException
Read a value.
Returns:
the value
void setSSL(boolean ssl)
Enable or disable SSL.
void setSSL(boolean ssl)
Enable or disable SSL.
Parameters:
ssl - the new value
void setSession(SessionInterface session)
Set the session.
void setSession(SessionInterface session)
Set the session.
Parameters:
session - the session
void setVersion(int version)
void setVersion(int version)
void verifyLobMac(byte[] hmac, long lobId)
Verify the HMAC.
void verifyLobMac(byte[] hmac, long lobId)
Verify the HMAC.
Parameters:
hmac - the message authentication code
lobId - the lobId
Throws:
DbException - if the HMAC does not match
Transfer writeBoolean(boolean x)
Write a boolean.
Transfer writeBoolean(boolean x) throws IOException
Write a boolean.
Parameters:
x - the value
Returns:
itself
Transfer writeBytes(byte[] data)
Write a byte array.
Transfer writeBytes(byte[] data) throws IOException
Write a byte array.
Parameters:
data - the value
Returns:
itself
Transfer writeBytes(byte[] buff, int off, int len)
Write a number of bytes.
Transfer writeBytes(byte[] buff, int off, int len) throws IOException
Write a number of bytes.
Parameters:
buff - the value
off - the offset
len - the length
Returns:
itself
Transfer writeInt(int x)
Write an int.
Transfer writeInt(int x) throws IOException
Write an int.
Parameters:
x - the value
Returns:
itself
Transfer writeLong(long x)
Write a long.
Transfer writeLong(long x) throws IOException
Write a long.
Parameters:
x - the value
Returns:
itself
Transfer writeString(String s)
Write a string.
Transfer writeString(String s) throws IOException
Write a string. The maximum string length is Integer.MAX_VALUE.
Parameters:
s - the value
Returns:
itself
void writeValue(Value v)
Write a value.
void writeValue(Value v) throws IOException
Write a value.
Parameters:
v - the value