Package org.h2.store

Class DataReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Readable

    public class DataReader
    extends java.io.Reader
    This class is backed by an input stream and supports reading values and variable size data.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  DataReader.FastEOFException
      Constructing such an EOF exception is fast, because the stack trace is not filled in.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.InputStream in  
      • Fields inherited from class java.io.Reader

        lock
    • Constructor Summary

      Constructors 
      Constructor Description
      DataReader​(java.io.InputStream in)
      Create a new data reader.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      int read​(char[] buff, int off, int len)  
      byte readByte()
      Read a byte.
      private char readChar()
      Read one character from the input stream.
      int readVarInt()
      Read a variable size integer.
      • Methods inherited from class java.io.Reader

        mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • in

        private final java.io.InputStream in
    • Constructor Detail

      • DataReader

        public DataReader​(java.io.InputStream in)
        Create a new data reader.
        Parameters:
        in - the input stream
    • Method Detail

      • readByte

        public byte readByte()
                      throws java.io.IOException
        Read a byte.
        Returns:
        the byte
        Throws:
        java.io.IOException - on failure
      • readVarInt

        public int readVarInt()
                       throws java.io.IOException
        Read a variable size integer.
        Returns:
        the value
        Throws:
        java.io.IOException - on failure
      • readChar

        private char readChar()
                       throws java.io.IOException
        Read one character from the input stream.
        Returns:
        the character
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class java.io.Reader
        Throws:
        java.io.IOException
      • read

        public int read​(char[] buff,
                        int off,
                        int len)
                 throws java.io.IOException
        Specified by:
        read in class java.io.Reader
        Throws:
        java.io.IOException