Class ByteArrayInputStream

    • Constructor Detail

      • ByteArrayInputStream

        public ByteArrayInputStream​(InputStream inputStream)
      • ByteArrayInputStream

        public ByteArrayInputStream​(byte[] bytes)
    • Method Detail

      • readInteger

        public int readInteger​(int length)
                        throws IOException
        Read int written in little-endian format.
        Parameters:
        length - length of the integer to read
        Returns:
        the integer from the binlog
        Throws:
        IOException - in case of EOF
      • readLong

        public long readLong​(int length)
                      throws IOException
        Read long written in little-endian format.
        Parameters:
        length - length of the long to read
        Returns:
        the long from the binlog
        Throws:
        IOException - in case of EOF
      • readString

        public String readString​(int length)
                          throws IOException
        Read fixed length string.
        Parameters:
        length - length of string to read
        Returns:
        string
        Throws:
        IOException - in case of EOF
      • readLengthEncodedString

        public String readLengthEncodedString()
                                       throws IOException
        Read variable-length string. Preceding packed integer indicates the length of the string.
        Returns:
        string
        Throws:
        IOException - in case of EOF
      • readZeroTerminatedString

        public String readZeroTerminatedString()
                                        throws IOException
        Read variable-length string. End is indicated by 0x00 byte.
        Returns:
        string
        Throws:
        IOException - in case of EOF
      • readPackedNumber

        public Number readPackedNumber()
                                throws IOException
        Format (first-byte-based):
        0-250 - The first byte is the number (in the range 0-250). No additional bytes are used.
        251 - SQL NULL value
        252 - Two more bytes are used. The number is in the range 251-0xffff.
        253 - Three more bytes are used. The number is in the range 0xffff-0xffffff.
        254 - Eight more bytes are used. The number is in the range 0xffffff-0xffffffffffffffff.
        Returns:
        long or null
        Throws:
        IOException - in case of malformed number or EOF
      • enterBlock

        public void enterBlock​(int length)
      • getPosition

        public int getPosition()
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class InputStream
      • fastSkip

        public long fastSkip​(long n)
                      throws IOException
        This method implements fast-forward skipping in the stream. It can be used if and only if the underlying stream is fully available till its end. In other cases the regular InputStream.skip(long) method must be used.
        Parameters:
        n - - number of bytes to skip
        Returns:
        number of bytes skipped
        Throws:
        IOException