Package org.h2.store

# Class CountingReaderInputStream

java.lang.Object
java.io.InputStream
org.h2.store.CountingReaderInputStream

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class CountingReaderInputStream extends InputStream
An input stream that reads the data from a reader and limits the number of bytes that can be read.

## Constructor Summary

Constructors
Constructor
Description
`CountingReaderInputStream(Reader reader, long maxLength)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`long`
`getLength()`
The number of characters read so far (but there might still be some bytes in the buffer).
`int`
`read()`
`int`
`read(byte[] buff, int offset, int len)`

### Methods inherited from class java.io.InputStream

`available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CountingReaderInputStream

public CountingReaderInputStream(Reader reader, long maxLength)

## Method Details

### read

public int read(byte[] buff, int offset, int len) throws IOException

Overrides:
  `read` in class `InputStream`
Throws:
  `IOException`

### read

public int read() throws IOException

Specified by:
  `read` in class `InputStream`
Throws:
  `IOException`

### getLength

public long getLength()
The number of characters read so far (but there might still be some bytes in the buffer).

Returns:
  the number of characters

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `InputStream`
Throws:
  `IOException`