public class RedisProtocol
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static char |
CR |
private java.io.BufferedInputStream |
is |
static char |
LF |
private java.io.OutputStream |
os |
private static char |
ZERO |
| Constructor and Description |
|---|
RedisProtocol(java.io.BufferedInputStream is,
java.io.OutputStream os)
Create a new RedisProtocol using provided input and output streams.
|
RedisProtocol(java.net.Socket socket)
Create a new RedisProtocol from a socket connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the input and output streams.
|
static byte[] |
readBytes(java.io.InputStream is)
Read fixed size field from the stream.
|
static long |
readLong(java.io.InputStream is)
Read a signed ascii integer from the input stream.
|
static Reply |
receive(java.io.InputStream is)
Read a Reply from an input stream.
|
Reply |
receiveAsync()
Wait for a reply on the input stream.
|
void |
sendAsync(Command command)
Send a command over the wire, do not wait for a reponse.
|
static byte[] |
toBytes(java.lang.Number length) |
public static final char CR
public static final char LF
private static final char ZERO
private final java.io.BufferedInputStream is
private final java.io.OutputStream os
public RedisProtocol(java.net.Socket socket)
throws java.io.IOException
socket - java.io.IOExceptionpublic RedisProtocol(java.io.BufferedInputStream is,
java.io.OutputStream os)
is - a buffered input stream is requiredos - a buffered input stream is requiredjava.io.IOExceptionpublic static byte[] readBytes(java.io.InputStream is)
throws java.io.IOException
is - java.io.IOExceptionpublic static long readLong(java.io.InputStream is)
throws java.io.IOException
is - java.io.IOExceptionpublic static Reply receive(java.io.InputStream is) throws java.io.IOException
is - java.io.IOExceptionpublic static byte[] toBytes(java.lang.Number length)
public Reply receiveAsync() throws java.io.IOException
java.io.IOExceptionpublic void sendAsync(Command command) throws java.io.IOException
command - java.io.IOExceptionpublic void close()
throws java.io.IOException
java.io.IOException