public class DynamicRemoteConnection extends java.lang.Object implements RemoteConnection
RemoteConnection that wraps another RemoteConnection that can change dynamically.| Constructor and Description |
|---|
DynamicRemoteConnection() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection.
|
void |
flushCommand()
Ends the command frame.
|
boolean |
readBoolean()
Reads a boolean parameter.
|
byte[] |
readByteArray()
Reads a byte array parameter.
|
java.io.InputStream |
readByteArrayAsInputStream()
Reads a byte array using an input stream.
|
java.lang.String |
readCommand()
Reads a command.
|
double |
readDouble()
Reads a double parameter.
|
float |
readFloat()
Reads a float parameter.
|
java.io.InputStream |
readInputStream()
Reads an input stream.
|
int |
readInt()
Reads an integer parameter.
|
long |
readLong()
Reads a long parameter.
|
java.util.List<java.lang.Object> |
readParameters()
Reads the parameters of a command.
|
java.lang.String |
readString()
Reads a string parameter.
|
void |
sendBoolean(boolean b)
Sends a boolean parameter.
|
void |
sendByteArray(byte[] a)
Sends a byte array parameter.
|
void |
sendByteArrayAsInputStream(java.io.InputStream is)
Sends a byte array parameter using an input stream.
|
void |
sendDouble(double d)
Sends a double parameter.
|
void |
sendFloat(float f)
Sends a float parameter.
|
void |
sendInputStream(java.io.InputStream is)
Sends an input stream.
|
void |
sendInt(int i)
Sends an integer parameter.
|
void |
sendLong(long l)
Sends a long parameter.
|
void |
sendParams(java.util.List<java.lang.Object> params)
Sends the given parameters.
|
void |
sendString(java.lang.String s)
Sends a string parameter.
|
void |
setConnection(RemoteConnection newConnection)
Set the underlying connection.
|
void |
skipParameters()
Skips the parameters of a command and get ready to read the following command.
|
void |
startCommand(java.lang.String command)
Starts a command.
|
public void setConnection(RemoteConnection newConnection)
public java.lang.String readCommand()
throws java.io.IOException
CommandReaderreadCommand in interface CommandReaderjava.io.IOException - the stream has been closed and the contained input stream does not support reading after close, or
another I/O error occurs.public java.lang.String readString()
throws java.io.IOException
CommandReaderreadString in interface CommandReaderjava.io.IOException - the stream has been closed and the contained input stream does not support reading after close, or
another I/O error occurs.public long readLong()
throws java.io.IOException
CommandReaderreadLong in interface CommandReaderjava.io.IOException - the stream has been closed and the contained input stream does not support reading after close, or
another I/O error occurs.public byte[] readByteArray()
throws java.io.IOException
CommandReaderreadByteArray in interface CommandReaderjava.io.IOException - the stream has been closed and the contained input stream does not support reading after close, or
another I/O error occurs.public java.io.InputStream readByteArrayAsInputStream()
throws java.io.IOException
CommandReaderThe returned input stream must be fully read before returning the method.
readByteArrayAsInputStream in interface CommandReaderjava.io.IOException - the stream has been closed and the contained input stream does not support reading after close, or
another I/O error occurs.public void startCommand(java.lang.String command)
CommandSenderA command can be followed by arguments.
startCommand in interface CommandSendercommand - the command name.public void sendString(java.lang.String s)
CommandSendersendString in interface CommandSenders - the string to send.public void sendLong(long l)
CommandSendersendLong in interface CommandSenderl - the long to send.public void sendByteArray(byte[] a)
CommandSendersendByteArray in interface CommandSendera - the byte array to send.public void sendByteArrayAsInputStream(java.io.InputStream is)
CommandSenderThe given input stream is fully read.
sendByteArrayAsInputStream in interface CommandSenderis - the input stream to send.public void flushCommand()
CommandSenderflushCommand in interface CommandSenderpublic void close()
RemoteConnectionclose in interface RemoteConnectionpublic void skipParameters()
throws java.io.IOException
CommandReaderskipParameters in interface CommandReaderjava.io.IOExceptionpublic java.util.List<java.lang.Object> readParameters()
throws java.io.IOException
RemoteConnection
Method CommandReader.skipParameters() must be called after to be ready to read the following command.
readParameters in interface RemoteConnectionjava.io.IOExceptionpublic void sendParams(java.util.List<java.lang.Object> params)
RemoteConnectionsendParams in interface RemoteConnectionparams - the list of parameters to send.public void sendInt(int i)
CommandSendersendInt in interface CommandSenderi - the integer to send.public void sendFloat(float f)
CommandSendersendFloat in interface CommandSenderf - the float to send.public void sendDouble(double d)
CommandSendersendDouble in interface CommandSenderd - the double to send.public void sendBoolean(boolean b)
CommandSendersendBoolean in interface CommandSenderb - the boolean to send.public int readInt()
throws java.io.IOException
CommandReaderreadInt in interface CommandReaderjava.io.IOException - the stream has been closed and the contained input stream does not support reading after close, or
another I/O error occurs.public float readFloat()
throws java.io.IOException
CommandReaderreadFloat in interface CommandReaderjava.io.IOException - the stream has been closed and the contained input stream does not support reading after close, or
another I/O error occurs.public double readDouble()
throws java.io.IOException
CommandReaderreadDouble in interface CommandReaderjava.io.IOException - the stream has been closed and the contained input stream does not support reading after close, or
another I/O error occurs.public boolean readBoolean()
throws java.io.IOException
CommandReaderreadBoolean in interface CommandReaderjava.io.IOException - the stream has been closed and the contained input stream does not support reading after close, or
another I/O error occurs.public void sendInputStream(java.io.InputStream is)
CommandSendersendInputStream in interface CommandSenderis - the input stream to send.public java.io.InputStream readInputStream()
throws java.io.IOException
CommandReaderThe returned input stream must be fully read before returning the method.
readInputStream in interface CommandReaderjava.io.IOException - the stream has been closed and the contained input stream does not support reading after close, or
another I/O error occurs.