public abstract class ProtocolBase extends Object implements Protocol
Modifier and Type | Class and Description |
---|---|
static class |
ProtocolBase.StreamBufferRequest
SimpleRequest implements the required
Message.read(InputStream)
using a (likely) shared data buffer. |
Protocol.Factory
Modifier and Type | Field and Description |
---|---|
static byte |
ASCII_ZERO |
static byte |
COUNT_BYTE |
static byte[] |
CRLF |
static int |
CRLF_LEN |
static int |
DELIMETER_LEN |
static byte |
ERR_BYTE |
static byte |
NUM_BYTE |
static byte |
OK_BYTE |
static byte |
SIZE_BYTE |
static byte[] |
SPACE |
Modifier | Constructor and Description |
---|---|
protected |
ProtocolBase() |
Modifier and Type | Method and Description |
---|---|
protected abstract Response |
createBooleanResponse(Command cmd) |
protected abstract Response |
createBulkResponse(Command cmd) |
protected abstract Response |
createMultiBulkResponse(Command cmd) |
protected abstract Response |
createNumberResponse(Command cmd) |
protected abstract Request |
createRequest(ByteArrayOutputStream buffer) |
Request |
createRequest(Command cmd,
byte[]... args) |
byte[] |
createRequestBuffer(Command cmd,
byte[]... args)
EXPERIMENTAL
|
protected abstract ByteArrayOutputStream |
createRequestBufffer(Command cmd) |
Response |
createResponse(Command cmd)
Creates a response object for the
Command specified. |
protected abstract Response |
createStatusResponse(Command cmd) |
protected abstract Response |
createStringResponse(Command cmd) |
boolean |
isCompatibleWithVersion(String version) |
public static final byte[] CRLF
public static final byte[] SPACE
public static final int CRLF_LEN
public static final int DELIMETER_LEN
public static final byte ERR_BYTE
public static final byte OK_BYTE
public static final byte COUNT_BYTE
public static final byte SIZE_BYTE
public static final byte NUM_BYTE
public static final byte ASCII_ZERO
public boolean isCompatibleWithVersion(String version)
isCompatibleWithVersion
in interface Protocol
public byte[] createRequestBuffer(Command cmd, byte[]... args) throws ProviderException, IllegalArgumentException
Protocol
createRequestBuffer
in interface Protocol
ProviderException
IllegalArgumentException
public Request createRequest(Command cmd, byte[]... args) throws ProviderException, IllegalArgumentException
createRequest
in interface Protocol
ProviderException
IllegalArgumentException
public Response createResponse(Command cmd) throws ProviderException, ClientRuntimeException
Protocol
Command
specified.
Note that this Response
object has not yet been read.
createResponse
in interface Protocol
cmd
- the Command
that will be responded to.ProviderException
- if the command is not implementedClientRuntimeException
- if the command is invalid for this version of the protocolResponse
protected abstract ByteArrayOutputStream createRequestBufffer(Command cmd)
protected abstract Request createRequest(ByteArrayOutputStream buffer)
Copyright © 2009–2016. All rights reserved.