Class BlobInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.postgresql.largeobject.BlobInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class BlobInputStream extends java.io.InputStream
This is an implementation of an InputStream from a large object.
-
-
Constructor Summary
Constructors Constructor Description BlobInputStream(LargeObject lo)
BlobInputStream(LargeObject lo, int bsize)
BlobInputStream(LargeObject lo, int bsize, long limit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this input stream and releases any system resources associated with the stream.void
mark(int readlimit)
Marks the current position in this input stream.boolean
markSupported()
Tests if this input stream supports themark
andreset
methods.int
read()
The minimum required to implement input stream.void
reset()
Repositions this stream to the position at the time themark
method was last called on this input stream.
-
-
-
Constructor Detail
-
BlobInputStream
public BlobInputStream(LargeObject lo)
- Parameters:
lo
- LargeObject to read from
-
BlobInputStream
public BlobInputStream(LargeObject lo, int bsize)
- Parameters:
lo
- LargeObject to read frombsize
- buffer size
-
BlobInputStream
public BlobInputStream(LargeObject lo, int bsize, long limit)
- Parameters:
lo
- LargeObject to read frombsize
- buffer sizelimit
- max number of bytes to read
-
-
Method Detail
-
read
public int read() throws java.io.IOException
The minimum required to implement input stream.- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
Closes this input stream and releases any system resources associated with the stream.
The
close
method ofInputStream
does nothing.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
- if an I/O error occurs.
-
mark
public void mark(int readlimit)
Marks the current position in this input stream. A subsequent call to the
reset
method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.The
readlimit
arguments tells this input stream to allow that many bytes to be read before the mark position gets invalidated.The general contract of
mark
is that, if the methodmarkSupported
returnstrue
, the stream somehow remembers all the bytes read after the call tomark
and stands ready to supply those same bytes again if and whenever the methodreset
is called. However, the stream is not required to remember any data at all if more thanreadlimit
bytes are read from the stream beforereset
is called.Marking a closed stream should not have any effect on the stream.
- Overrides:
mark
in classjava.io.InputStream
- Parameters:
readlimit
- the maximum limit of bytes that can be read before the mark position becomes invalid.- See Also:
InputStream.reset()
-
reset
public void reset() throws java.io.IOException
Repositions this stream to the position at the time themark
method was last called on this input stream. NB: If mark is not called we move to the beginning.- Overrides:
reset
in classjava.io.InputStream
- Throws:
java.io.IOException
- See Also:
InputStream.mark(int)
,IOException
-
markSupported
public boolean markSupported()
Tests if this input stream supports themark
andreset
methods. ThemarkSupported
method ofInputStream
returnsfalse
.- Overrides:
markSupported
in classjava.io.InputStream
- Returns:
true
if this true type supports the mark and reset method;false
otherwise.- See Also:
InputStream.mark(int)
,InputStream.reset()
-
-