Interface ReadableByteBuf

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long atoll​(int length)
      Fast signed long parsing
      long atoull​(int length)
      Fast unsigned long parsing
      byte[] buf()
      buffer
      void buf​(byte[] buf, int limit, int pos)
      Reset buffer
      byte getByte()
      Read byte from buffer at current position, without changing position
      byte getByte​(int index)
      Read byte from buffer at indicated index, without changing position
      short getUnsignedByte()
      Read unsigned byte value at current position, without changing position
      int pos()
      Current buffer position
      void pos​(int pos)
      Set position
      int readableBytes()
      buffer number of unread bytes
      java.lang.String readAscii​(int length)
      Read ascii encoded string from length bytes
      MariaDbBlob readBlob​(int length)
      Read Blob at current position
      byte readByte()
      Read byte at current position, incrementing position
      void readBytes​(byte[] dst)
      Read as many bytes to fill destination array
      byte[] readBytesNullEnd()
      Read null-ended encoded bytes.
      double readDouble()
      Read double encoded on 8 bytes value at current position
      double readDoubleBE()
      Read double encoded on 8 bytes (big endian) value at current position
      float readFloat()
      Read float encoded on 4 bytes value at current position
      int readInt()
      Read signed 4 bytes value (little endian) at current position
      int readIntBE()
      Read signed 4 bytes value (big endian) at current position
      int readIntLengthEncodedNotNull()
      Read encoded length value that cannot be null
      java.lang.Integer readLength()
      Read encoded length value
      ReadableByteBuf readLengthBuffer()
      Return a length encoded buffer
      long readLong()
      Read signed 8 bytes value (little endian) at current position
      long readLongBE()
      Read unsigned 4 bytes value (big endian) at current position
      long readLongLengthEncodedNotNull()
      Read encoded length value that cannot be null
      int readMedium()
      Read signed 3 bytes value (little endian) at current position
      short readShort()
      Read signed 2 bytes value (little endian) at current position
      java.lang.String readString​(int length)
      Read utf-8 encoded string from length bytes
      java.lang.String readStringEof()
      Return the utf-8 string represented by current position to the limit of buffer
      java.lang.String readStringNullEnd()
      Read null-ended utf-8 encoded string.
      short readUnsignedByte()
      Read unsigned byte value at current position
      long readUnsignedInt()
      Read unsigned 4 bytes value (little endian) at current position
      int readUnsignedMedium()
      Read unsigned 3 bytes value (little endian) at current position
      int readUnsignedShort()
      Read unsigned 2 bytes value (little endian) at current position
      void skip()
      Skip one byte
      void skip​(int length)
      Skip length value of bytes
      int skipIdentifier()
      Utility to skip length encoded string, returning initial position
      void skipLengthEncoded()
      Skip length encoded value
    • Method Detail

      • readableBytes

        int readableBytes()
        buffer number of unread bytes
        Returns:
        remaining bytes number
      • pos

        int pos()
        Current buffer position
        Returns:
        position
      • buf

        byte[] buf()
        buffer
        Returns:
        buffer
      • buf

        void buf​(byte[] buf,
                 int limit,
                 int pos)
        Reset buffer
        Parameters:
        buf - new buffer
        limit - buffer limit
        pos - initial position
      • pos

        void pos​(int pos)
        Set position
        Parameters:
        pos - new position
      • skip

        void skip()
        Skip one byte
      • skip

        void skip​(int length)
        Skip length value of bytes
        Parameters:
        length - number of position to skip
      • skipLengthEncoded

        void skipLengthEncoded()
        Skip length encoded value
      • readBlob

        MariaDbBlob readBlob​(int length)
        Read Blob at current position
        Parameters:
        length - blob length
        Returns:
        Blob
      • getByte

        byte getByte()
        Read byte from buffer at current position, without changing position
        Returns:
        byte value
      • getByte

        byte getByte​(int index)
        Read byte from buffer at indicated index, without changing position
        Parameters:
        index - index
        Returns:
        byte value
      • getUnsignedByte

        short getUnsignedByte()
        Read unsigned byte value at current position, without changing position
        Returns:
        short value
      • readLongLengthEncodedNotNull

        long readLongLengthEncodedNotNull()
        Read encoded length value that cannot be null
        Returns:
        encoded length
        See Also:
        length encoded integer
      • readIntLengthEncodedNotNull

        int readIntLengthEncodedNotNull()
        Read encoded length value that cannot be null
        Returns:
        encoded length
        See Also:
        length encoded integer

        this is readLongLengthEncodedNotNull limited to 32 bits

      • skipIdentifier

        int skipIdentifier()
        Utility to skip length encoded string, returning initial position
        Returns:
        initial position
      • atoll

        long atoll​(int length)
        Fast signed long parsing
        Parameters:
        length - data length
        Returns:
        long value
      • atoull

        long atoull​(int length)
        Fast unsigned long parsing
        Parameters:
        length - data length
        Returns:
        long value
      • readLength

        java.lang.Integer readLength()
        Read encoded length value
        Returns:
        encoded length
        See Also:
        length encoded integer
      • readByte

        byte readByte()
        Read byte at current position, incrementing position
        Returns:
        byte at current position
      • readUnsignedByte

        short readUnsignedByte()
        Read unsigned byte value at current position
        Returns:
        short value
      • readShort

        short readShort()
        Read signed 2 bytes value (little endian) at current position
        Returns:
        short value
      • readUnsignedShort

        int readUnsignedShort()
        Read unsigned 2 bytes value (little endian) at current position
        Returns:
        short value
      • readMedium

        int readMedium()
        Read signed 3 bytes value (little endian) at current position
        Returns:
        int value
      • readUnsignedMedium

        int readUnsignedMedium()
        Read unsigned 3 bytes value (little endian) at current position
        Returns:
        int value
      • readInt

        int readInt()
        Read signed 4 bytes value (little endian) at current position
        Returns:
        int value
      • readIntBE

        int readIntBE()
        Read signed 4 bytes value (big endian) at current position
        Returns:
        int value
      • readUnsignedInt

        long readUnsignedInt()
        Read unsigned 4 bytes value (little endian) at current position
        Returns:
        long value
      • readLong

        long readLong()
        Read signed 8 bytes value (little endian) at current position
        Returns:
        long value
      • readLongBE

        long readLongBE()
        Read unsigned 4 bytes value (big endian) at current position
        Returns:
        long value
      • readBytes

        void readBytes​(byte[] dst)
        Read as many bytes to fill destination array
        Parameters:
        dst - destination array
      • readBytesNullEnd

        byte[] readBytesNullEnd()
        Read null-ended encoded bytes. 0x00 null value won't be in return byte, so position is incremented to returned byte array length + 1
        Returns:
        byte array
      • readLengthBuffer

        ReadableByteBuf readLengthBuffer()
        Return a length encoded buffer
        Returns:
        new buffer
      • readString

        java.lang.String readString​(int length)
        Read utf-8 encoded string from length bytes
        Parameters:
        length - length byte to read
        Returns:
        string value
      • readAscii

        java.lang.String readAscii​(int length)
        Read ascii encoded string from length bytes
        Parameters:
        length - length byte to read
        Returns:
        string value
      • readStringNullEnd

        java.lang.String readStringNullEnd()
        Read null-ended utf-8 encoded string. 0x00 = null represent string ending. Position is incremented to returned string corresponding bytes + 1
        Returns:
        corresponding string
      • readStringEof

        java.lang.String readStringEof()
        Return the utf-8 string represented by current position to the limit of buffer
        Returns:
        string value
      • readFloat

        float readFloat()
        Read float encoded on 4 bytes value at current position
        Returns:
        float value
      • readDouble

        double readDouble()
        Read double encoded on 8 bytes value at current position
        Returns:
        double value
      • readDoubleBE

        double readDoubleBE()
        Read double encoded on 8 bytes (big endian) value at current position
        Returns:
        double value