Top Description Inners Fields Constructors Methods
org.h2.store

public Class DataReader

extends Reader
Class Inheritance
Imports
java.io.EOFException, .IOException, .InputStream, .Reader

This class is backed by an input stream and supports reading values and variable size data.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
DataReader.FastEOFException

Constructing such an EOF exception is fast, because the stack trace is not filled in. If used in a static context, this will also avoid classloader memory leaks.

Field Summary

Modifier and TypeField and Description
private final InputStream
Inherited from java.io.Reader:
lock

Constructor Summary

AccessConstructor and Description
public
DataReader(InputStream
the input stream
in
)

Create a new data reader.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Closes the stream and releases any system resources associated with it.

public int
read(char[]
Destination buffer
buff
,
int
Offset at which to start storing characters
off
,
int
Maximum number of characters to read
len
)

Implements abstract java.io.Reader.read.

Reads characters into a portion of an array.

public byte

Returns:

the byte
readByte
()

Read a byte.

private char

Returns:

the character
readChar
()

Read one character from the input stream.

public int

Returns:

the value
readVarInt
()

Read a variable size integer.

Inherited from java.io.Reader:
markmarkSupportednullReaderofreadreadreadreadyresetskiptransferTo

Field Detail

inback to summary
private final InputStream in

Constructor Detail

DataReaderback to summary
public DataReader(InputStream in)

Create a new data reader.

Parameters
in:InputStream

the input stream

Method Detail

closeback to summary
public void close() throws IOException

Implements abstract java.io.Reader.close.

Implements java.io.Closeable.close.

Doc from java.io.Reader.close.

Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
readback to summary
public int read(char[] buff, int off, int len) throws IOException

Implements abstract java.io.Reader.read.

Doc from java.io.Reader.read.

Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

If len is zero, then no characters are read and 0 is returned; otherwise, there is an attempt to read at least one character. If no character is available because the stream is at its end, the value -1 is returned; otherwise, at least one character is read and stored into cbuf.

Parameters
buff:char[]

Destination buffer

off:int

Offset at which to start storing characters

len:int

Maximum number of characters to read

Returns:int

The number of characters read, or -1 if the end of the stream has been reached

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
readByteback to summary
public byte readByte() throws IOException

Read a byte.

Returns:byte

the byte

Exceptions
IOException:
on failure
readCharback to summary
private char readChar() throws IOException

Read one character from the input stream.

Returns:char

the character

readVarIntback to summary
public int readVarInt() throws IOException

Read a variable size integer.

Returns:int

the value

Exceptions
IOException:
on failure
org.h2.store back to summary

pack-priv Class DataReader.FastEOFException

extends EOFException
Class Inheritance

Constructing such an EOF exception is fast, because the stack trace is not filled in. If used in a static context, this will also avoid classloader memory leaks.

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public synchronized Throwable
fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace.

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.io.EOFException.serialVersionUID.

Constructor Detail

FastEOFExceptionback to summary
pack-priv FastEOFException()

Method Detail

fillInStackTraceback to summary
public synchronized Throwable fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Doc from java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace. This method records within this Throwable object information about the current state of the stack frames for the current thread.

If the stack trace of this Throwable is not writable, calling this method has no effect.

Returns:Throwable

a reference to this Throwable instance.

Annotations
@Override