Package naga

Interface PacketReader

All Known Implementing Classes:
AsciiLinePacketReader, CipherPacketReader, DelimiterPacketReader, RawPacketReader, RegularPacketReader, SSLPacketHandler, StreamCipherPacketReader, ZeroDelimitedPacketReader

public interface PacketReader
Interface for packet reader plugins to assist a socket in reading.

PacketReaders are in general intended to help splitting

Author:
Christoffer Lerno
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte[]
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    nextPacket(ByteBuffer byteBuffer)
    Create a new packet using the ByteBuffer given.
  • Field Details

    • SKIP_PACKET

      static final byte[] SKIP_PACKET
  • Method Details

    • nextPacket

      byte[] nextPacket(ByteBuffer byteBuffer) throws ProtocolViolationException
      Create a new packet using the ByteBuffer given.

      If there isn't sufficient data to construct a packet, return null.

      Parameters:
      byteBuffer - the byte buffer to use.
      Returns:
      the new packet created, or null if no packet could be created. The method will continously be called until nextPacket returns null.
      Throws:
      ProtocolViolationException - is there was an error constructing the packet.