com.thimbleware.jmemcached
Class CommandDecoder
java.lang.Object
org.apache.mina.filter.codec.demux.MessageDecoderAdapter
com.thimbleware.jmemcached.CommandDecoder
- All Implemented Interfaces:
- org.apache.mina.filter.codec.demux.MessageDecoder
public final class CommandDecoder
- extends org.apache.mina.filter.codec.demux.MessageDecoderAdapter
MINA MessageDecoderAdapter responsible for parsing inbound lines from the memcached protocol session.
|
Field Summary |
static java.nio.charset.CharsetDecoder |
DECODER
|
| Fields inherited from interface org.apache.mina.filter.codec.demux.MessageDecoder |
NEED_DATA, NOT_OK, OK |
|
Method Summary |
org.apache.mina.filter.codec.demux.MessageDecoderResult |
decodable(org.apache.mina.common.IoSession session,
org.apache.mina.common.ByteBuffer in)
Checks the specified buffer is decodable by this decoder. |
org.apache.mina.filter.codec.demux.MessageDecoderResult |
decode(org.apache.mina.common.IoSession session,
org.apache.mina.common.ByteBuffer in,
org.apache.mina.filter.codec.ProtocolDecoderOutput out)
Actually decodes inbound data from the memcached protocol session. |
int |
Now()
|
| Methods inherited from class org.apache.mina.filter.codec.demux.MessageDecoderAdapter |
finishDecode |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DECODER
public static java.nio.charset.CharsetDecoder DECODER
CommandDecoder
public CommandDecoder()
decodable
public final org.apache.mina.filter.codec.demux.MessageDecoderResult decodable(org.apache.mina.common.IoSession session,
org.apache.mina.common.ByteBuffer in)
- Checks the specified buffer is decodable by this decoder.
In our case checks the session state to see if we are waiting for data. If we are, make sure
that we actually have all the data we need.
- Returns:
MessageDecoder.OK if this decoder can decode the specified buffer.
MessageDecoder.NOT_OK if this decoder cannot decode the specified buffer.
MessageDecoder.NEED_DATA if more data is required to determine if the
specified buffer is decodable (MessageDecoder.OK) or not decodable
MessageDecoder.NOT_OK.
decode
public final org.apache.mina.filter.codec.demux.MessageDecoderResult decode(org.apache.mina.common.IoSession session,
org.apache.mina.common.ByteBuffer in,
org.apache.mina.filter.codec.ProtocolDecoderOutput out)
throws java.lang.Exception
- Actually decodes inbound data from the memcached protocol session.
MINA invokes
decode(IoSession, ByteBuffer, ProtocolDecoderOutput)
method with read data, and then the decoder implementation puts decoded
messages into ProtocolDecoderOutput.
- Returns:
MessageDecoder.OK if finished decoding messages successfully.
MessageDecoder.NEED_DATA if you need more data to finish decoding current message.
MessageDecoder.NOT_OK if you cannot decode current message due to protocol specification violation.
- Throws:
java.lang.Exception - if the read data violated protocol specification
Now
public final int Now()
- Returns:
- the current time in seconds
Copyright © 2008. All Rights Reserved.