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