Interface PacketReader

All Known Implementing Classes:
ByteBufPacketReader

public interface PacketReader
Interface for decoding packets into data.

used to abstract out the implementation details of netty.

  • Method Details

    • readString

      String readString(int length)
      Reads the next N bytes as a string.

      NOTE:Strings in KRO are 0-terminated and use pre-determined lengths. So "hello" of length 20 will be "hello" 0x0 0x0 0x0...

      Parameters:
      length - the size of the string, with zero padding.
      Returns:
      The string object.
    • readBytes

      byte[] readBytes(int length)
    • readInetAddressAndPort

      InetAddressAndPort readInetAddressAndPort() throws UnknownHostException
      Reads the address and port pair from the kro server byte stream, which is a 6-byte series.
      Returns:
      The IP address and port pair
      Throws:
      UnknownHostException
      See Also:
    • skip

      void skip(int length)
      Skip N bytes
      Parameters:
      length - number of bytes to skip
    • readShortLE

      short readShortLE()
      Returns:
      the next 4-byte short in the stream
    • readIntLE

      int readIntLE()
      Returns:
      the next 4-byte integer in the stream
    • readByte

      byte readByte()
      Returns:
      the next byte in the stream
    • getUnderlyingObject

      <T> T getUnderlyingObject()
      Type Parameters:
      T - The underlying object type.
      Returns:
      The underlying object that backs this packet reader, usually a byte buffer.
    • size

      int size()
      Returns:
      the size of the packet
    • readLongLE

      long readLongLE()