Package net.sf.cindy.packet

Examples of net.sf.cindy.packet.DefaultPacket


*/
public class ByteBufferEncoder implements PacketEncoder {

    public Packet encode(Session session, Object obj) throws Exception {
        if (obj instanceof ByteBuffer)
            return new DefaultPacket((ByteBuffer) obj);
        return null;
    }
View Full Code Here


                            buffer.release();
                            break;
                        }
                        buffer.limit(byteBuffer.position());
                        getSessionFilterChain(false).packetReceived(
                                new DefaultPacket(buffer, address));
                    } catch (IOException e) {
                        buffer.release();
                        throw e;
                    }
                }
View Full Code Here

*/
public class SimplePacketDecoder implements PacketDecoder {

    public Object decode(Session session, Packet packet) throws Exception {
        Buffer buffer = packet.getContent();
        return new DefaultPacket(BufferFactory.allocate(buffer.remaining())
                .put(0, buffer), packet.getAddress());
    }
View Full Code Here

                }

                if (readCount > 0) {
                    buffer.flip();
                    getSessionFilterChain(false).packetReceived(
                            new DefaultPacket(buffer, address));
                }
                if (n < 0) // Connection closed
                    throw new ClosedChannelException();
            }
View Full Code Here

                }

                if (readCount > 0) {
                    buffer.flip();
                    getSessionFilterChain(false).packetReceived(
                            new DefaultPacket(buffer));
                }
                if (n < 0) // Connection closed
                    throw new ClosedChannelException();
            }
View Full Code Here

    protected void recognize(Buffer content, SocketAddress address)
            throws Exception {
        while (content.hasRemaining()) {
            Buffer slice = content.asReadOnlyBuffer().slice();
            Object obj = session.getPacketDecoder().decode(session,
                    new DefaultPacket(slice, address));
            if (obj == null)
                break;
            content.skip(slice.position());
            session.getSessionFilterChain(false).objectReceived(obj);
        }
View Full Code Here

TOP

Related Classes of net.sf.cindy.packet.DefaultPacket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.