Package net.sourceforge.jtds.util
Class BlobBuffer.BlobInputStream
java.lang.Object
java.io.InputStream
net.sourceforge.jtds.util.BlobBuffer.BlobInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Enclosing class:
BlobBuffer
An
InputStream
over the BLOB buffer.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBlobInputStream
(long pos) Costructs anInputStream
object over the BLOB buffer. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of bytes available to read.void
close()
Closes the output stream.protected void
finalize()
Ensures underlying BLOB file can be closed even if user does not close this stream.int
read()
Reads the next byte from the stream.int
read
(byte[] bytes, int offset, int len) Reads a bytes from the stream.Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
readPtr
private int readPtr -
open
private boolean open
-
-
Constructor Details
-
BlobInputStream
Costructs anInputStream
object over the BLOB buffer.- Parameters:
pos
- the starting position (from 0)- Throws:
IOException
- if an I/O error occurs
-
-
Method Details
-
finalize
Ensures underlying BLOB file can be closed even if user does not close this stream. -
available
Returns the number of bytes available to read.- Overrides:
available
in classInputStream
- Throws:
IOException
- if an I/O error occurs
-
read
Reads the next byte from the stream.- Specified by:
read
in classInputStream
- Returns:
- the next byte as an
int
or -1 if at EOF - Throws:
IOException
- if an I/O error occurs
-
read
Reads a bytes from the stream.- Overrides:
read
in classInputStream
- Parameters:
bytes
- the byte array to filloffset
- the start position in the byte arraylen
- the number of bytes to read- Returns:
- the number of bytes read or -1 if at end of file
- Throws:
IOException
- if an I/O error occurs
-
close
Closes the output stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
- if an I/O error occurs
-