public abstract class AbstractJslipcMessage extends Object
JslipcRequest
and JslipcResponse
.Modifier and Type | Field and Description |
---|---|
protected static String |
JSLIPC_PROTOCOL_PREFIX |
static String |
PARAM_ACCEPT_TYPES |
static String |
PARAM_DIRECTORY |
static String |
PARAM_FILE |
static String |
PARAM_ROLE |
static String |
PARAM_SIZE |
static String |
PARAM_TYPE |
protected static List<Class<? extends JslipcPipe>> |
SUPPORTED_PIPES |
Constructor and Description |
---|
AbstractJslipcMessage(byte[] message)
Creates a message from its byte array representation.
|
AbstractJslipcMessage(String message)
Creates a message from its string representation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
File |
getFileParameter(String key)
Returns the value of the parameter as a File, or
null if not
found. |
protected abstract String |
getHeader() |
Integer |
getIntParameter(String key)
Returns the integer value of the parameter, or
null if not
found. |
protected abstract String |
getMessageName() |
String |
getParameter(String key)
Returns the parameter or
null if not found. |
Map<String,String> |
getParameters() |
String |
getProtocol() |
String |
getProtocolVersion() |
protected Class<? extends JslipcPipe> |
getTypeClass(String type) |
protected String |
getTypeName(Class<? extends JslipcPipe> pipeClass) |
Class<? extends JslipcPipe> |
getTypeParameter() |
int |
hashCode() |
boolean |
hasParameter(String key) |
protected abstract String |
parseHeader(String header)
Parses the header line of the message.
|
protected void |
parseMessage(String message)
Parses the message header and parameter.
|
void |
setFileParameter(String key,
File file)
Sets the given File parameter.
|
void |
setIntParameter(String key,
Integer integer)
Sets the given integer parameter.
|
void |
setParameter(String key,
String value)
Adds a parameter.
|
void |
setTypeParameter(Class<? extends JslipcPipe> type) |
byte[] |
toBytes() |
String |
toString() |
public static final String PARAM_DIRECTORY
public static final String PARAM_FILE
public static final String PARAM_ROLE
public static final String PARAM_TYPE
public static final String PARAM_SIZE
public static final String PARAM_ACCEPT_TYPES
protected static final String JSLIPC_PROTOCOL_PREFIX
protected static final List<Class<? extends JslipcPipe>> SUPPORTED_PIPES
public AbstractJslipcMessage(byte[] message) throws IOException
IOException
toBytes()
public AbstractJslipcMessage(String message) throws IOException
IOException
toString()
protected abstract String getMessageName()
protected void parseMessage(String message) throws IOException
IOException
protected abstract String parseHeader(String header) throws IOException
header
- IOException
public String getParameter(String key)
null
if not found.key
- null
.public File getFileParameter(String key)
null
if not
found.key
- null
.public void setFileParameter(String key, File file)
key
- file
- public Integer getIntParameter(String key) throws IOException
null
if not
found.key
- null
.IOException
- if the given value is not an integer.public void setIntParameter(String key, Integer integer) throws IOException
key
- integer
- IOException
public Class<? extends JslipcPipe> getTypeParameter()
PARAM_TYPE
.public void setTypeParameter(Class<? extends JslipcPipe> type)
type
- the type to set.protected String getTypeName(Class<? extends JslipcPipe> pipeClass)
protected Class<? extends JslipcPipe> getTypeClass(String type)
public boolean hasParameter(String key)
key
- true
if the given parameter exists.public void setParameter(String key, String value)
key
- value
- public String getProtocolVersion()
public String getProtocol()
JSLIPC/1.0
.protected abstract String getHeader()
public byte[] toBytes()
Copyright © 2014. All Rights Reserved.