|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.filter.codec.prefixedstring.PrefixedStringCodecFactory
public class PrefixedStringCodecFactory
A ProtocolCodecFactory
that performs encoding and decoding
of a Java String object using a fixed-length length prefix.
Constructor Summary | |
---|---|
PrefixedStringCodecFactory()
|
|
PrefixedStringCodecFactory(Charset charset)
|
Method Summary | |
---|---|
ProtocolDecoder |
getDecoder(IoSession session)
Returns a new (or reusable) instance of ProtocolDecoder which
decodes binary or protocol-specific data into message objects. |
int |
getDecoderMaxDataLength()
Returns the allowed maximum size of a decoded string. |
int |
getDecoderPrefixLength()
Gets the length of the length prefix (1, 2, or 4) used by the decoder |
ProtocolEncoder |
getEncoder(IoSession session)
Returns a new (or reusable) instance of ProtocolEncoder which
encodes message objects into binary or protocol-specific data. |
int |
getEncoderMaxDataLength()
Returns the allowed maximum size of an encoded string. |
int |
getEncoderPrefixLength()
Gets the length of the length prefix (1, 2, or 4) used by the encoder |
void |
setDecoderMaxDataLength(int maxDataLength)
Sets the maximum allowed value specified as data length in the decoded data |
void |
setDecoderPrefixLength(int prefixLength)
Sets the length of the prefix used by the decoder |
void |
setEncoderMaxDataLength(int maxDataLength)
Sets the allowed maximum size of an encoded String. |
void |
setEncoderPrefixLength(int prefixLength)
Sets the length of the prefix used by the encoder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PrefixedStringCodecFactory(Charset charset)
public PrefixedStringCodecFactory()
Method Detail |
---|
public int getEncoderMaxDataLength()
IllegalArgumentException
.
The default value is PrefixedStringEncoder.DEFAULT_MAX_DATA_LENGTH
.
This method does the same job as PrefixedStringEncoder.setMaxDataLength(int)
.
public void setEncoderMaxDataLength(int maxDataLength)
IllegalArgumentException
.
The default value is PrefixedStringEncoder.DEFAULT_MAX_DATA_LENGTH
.
This method does the same job as PrefixedStringEncoder.getMaxDataLength()
.
maxDataLength
- allowed maximum size of an encoded String.public int getDecoderMaxDataLength()
This method does the same job as PrefixedStringEncoder.setMaxDataLength(int)
.
setDecoderMaxDataLength(int)
public void setDecoderMaxDataLength(int maxDataLength)
Useful for preventing an OutOfMemory attack by the peer.
The decoder will throw a BufferDataException
when data length
specified in the incoming data is greater than maxDataLength
The default value is PrefixedStringDecoder.DEFAULT_MAX_DATA_LENGTH
.
This method does the same job as PrefixedStringDecoder.setMaxDataLength(int)
.
maxDataLength
- maximum allowed value specified as data length in the incoming datapublic void setDecoderPrefixLength(int prefixLength)
prefixLength
- the length of the length prefix (1, 2, or 4)public int getDecoderPrefixLength()
public void setEncoderPrefixLength(int prefixLength)
prefixLength
- the length of the length prefix (1, 2, or 4)public int getEncoderPrefixLength()
public ProtocolEncoder getEncoder(IoSession session) throws Exception
ProtocolCodecFactory
ProtocolEncoder
which
encodes message objects into binary or protocol-specific data.
getEncoder
in interface ProtocolCodecFactory
Exception
public ProtocolDecoder getDecoder(IoSession session) throws Exception
ProtocolCodecFactory
ProtocolDecoder
which
decodes binary or protocol-specific data into message objects.
getDecoder
in interface ProtocolCodecFactory
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |