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 Protocolpublic byte[] createRequestBuffer(Command cmd, byte[]... args) throws ProviderException, IllegalArgumentException
ProtocolcreateRequestBuffer in interface ProtocolProviderExceptionIllegalArgumentExceptionpublic Request createRequest(Command cmd, byte[]... args) throws ProviderException, IllegalArgumentException
createRequest in interface ProtocolProviderExceptionIllegalArgumentExceptionpublic Response createResponse(Command cmd) throws ProviderException, ClientRuntimeException
ProtocolCommand specified.
Note that this Response object has not yet been read.
createResponse in interface Protocolcmd - the Command that will be responded to.ProviderException - if the command is not implementedClientRuntimeException - if the command is invalid for this version of the protocolResponseprotected abstract ByteArrayOutputStream createRequestBufffer(Command cmd)
protected abstract Request createRequest(ByteArrayOutputStream buffer)
Copyright © 2009–2021. All rights reserved.