Class DbInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.commons.io.input.ProxyInputStream
org.apache.commons.io.input.AutoCloseInputStream
org.apache.jackrabbit.core.data.db.DbInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This class represents an input stream backed by a database. The database
objects are only acquired when reading from the stream, and stay open until
the stream is closed, fully read, or garbage collected.
This class does not support mark/reset. It is always to be wrapped using a BufferedInputStream.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.io.input.AutoCloseInputStream
AutoCloseInputStream.Builder -
Method Summary
Modifier and TypeMethodDescriptionintInvokes the delegate'savailable()method.voidclose()Closes the underlying input stream and replaces the reference to it with aClosedInputStreaminstance.voidmark(int readlimit) This method does nothing.booleanCheck whether mark and reset are supported.intread()Invokes the delegate'sread()method.intread(byte[] b) Invokes the delegate'sread(byte[])method.intread(byte[] b, int off, int len) Invokes the delegate'sread(byte[], int, int)method.voidreset()This method does nothing.longskip(long n) Invokes the delegate'sskip(long)method.Methods inherited from class org.apache.commons.io.input.AutoCloseInputStream
builderMethods inherited from class org.apache.commons.io.input.ProxyInputStream
unwrapMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Method Details
-
read
Invokes the delegate'sread()method. When the stream is consumed, the database objects held by the instance are closed.- Overrides:
readin classProxyInputStream- Returns:
- the byte read or -1 if the end of stream
- Throws:
IOException- if an I/O error occurs.
-
read
Invokes the delegate'sread(byte[])method. When the stream is consumed, the database objects held by the instance are closed.- Overrides:
readin classProxyInputStream- Parameters:
b- the buffer to read the bytes into- Returns:
- the number of bytes read or EOF if the end of stream
- Throws:
IOException- if an I/O error occurs.
-
read
Invokes the delegate'sread(byte[], int, int)method. When the stream is consumed, the database objects held by the instance are closed.- Overrides:
readin classProxyInputStream- Parameters:
b- the buffer to read the bytes intooff- The start offsetlen- The number of bytes to read- Returns:
- the number of bytes read or -1 if the end of stream
- Throws:
IOException- if an I/O error occurs.
-
close
Closes the underlying input stream and replaces the reference to it with aClosedInputStreaminstance.This method is automatically called by the read methods when the end of input has been reached.
Note that it is safe to call this method any number of times. The original underlying input stream is closed and discarded only once when this method is first called.
When the stream is consumed, the database objects held by the instance are closed.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAutoCloseInputStream- Throws:
IOException- if the underlying input stream can not be closed
-
skip
Invokes the delegate'sskip(long)method.- Overrides:
skipin classProxyInputStream- Parameters:
n- the number of bytes to skip- Returns:
- the actual number of bytes skipped
- Throws:
IOException- if an I/O error occurs.
-
available
Invokes the delegate'savailable()method.- Overrides:
availablein classProxyInputStream- Returns:
- the number of available bytes
- Throws:
IOException- if an I/O error occurs.
-
mark
public void mark(int readlimit) This method does nothing.- Overrides:
markin classProxyInputStream- Parameters:
readlimit- read ahead limit
-
reset
This method does nothing.- Overrides:
resetin classProxyInputStream- Throws:
IOException- if an I/O error occurs.
-
markSupported
public boolean markSupported()Check whether mark and reset are supported.- Overrides:
markSupportedin classProxyInputStream- Returns:
- false
-