T - Output type.public abstract class CommandOutput<K,V,T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected RedisCodec<K,V> |
codec |
protected java.lang.String |
error |
protected T |
output |
| Constructor and Description |
|---|
CommandOutput(RedisCodec<K,V> codec,
T output)
Initialize a new instance that encodes and decodes keys and
values using the supplied codec.
|
| Modifier and Type | Method and Description |
|---|---|
void |
complete(int depth)
Mark the command output complete.
|
protected java.lang.String |
decodeAscii(java.nio.ByteBuffer bytes) |
T |
get()
Get the command output.
|
java.lang.String |
getError()
Get the error that occurred.
|
boolean |
hasError()
Check if the command resulted in an error.
|
void |
set(java.nio.ByteBuffer bytes)
Set the command output to a sequence of bytes, or null.
|
void |
set(long integer)
Set the command output to a 64-bit signed integer.
|
void |
setError(java.nio.ByteBuffer error)
Set command output to an error message from the server.
|
void |
setError(java.lang.String error)
Set command output to an error message from the client.
|
protected RedisCodec<K,V> codec
protected T output
protected java.lang.String error
public CommandOutput(RedisCodec<K,V> codec, T output)
codec - Codec used to encode/decode keys and values.output - Initial value of output.public T get()
public void set(java.nio.ByteBuffer bytes)
CommandOutput implementations must override this method
unless they only receive an integer value which cannot be null.bytes - The command output, or null.public void set(long integer)
CommandOutput implementations must override this method
unless they only receive a byte array value.integer - The command output.public void setError(java.nio.ByteBuffer error)
error - Error message.public void setError(java.lang.String error)
error - Error message.public boolean hasError()
public java.lang.String getError()
public void complete(int depth)
depth - Remaining depth of output queue.protected java.lang.String decodeAscii(java.nio.ByteBuffer bytes)