- java.lang.Object
-
- java.io.InputStream
-
- org.postgresql.pljava.jdbc.BlobValue
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Blob
public class BlobValue extends InputStream implements Blob
Implementation ofBlob
for the SPI connection.- Author:
- Thomas Hallgren
-
-
Constructor Summary
Constructors Constructor Description BlobValue(byte[] bytes)
BlobValue(InputStream stream, long nBytes)
-
Method Summary
Modifier and Type Method Description int
available()
void
free()
InputStream
getBinaryStream()
InputStream
getBinaryStream(long pos, long length)
byte[]
getBytes(long pos, int length)
void
getContents(ByteBuffer buf)
Called from within...static int
getStreamLength(InputStream value)
long
length()
void
mark(int readLimit)
boolean
markSupported()
long
position(byte[] pattern, long start)
Not supported.long
position(Blob pattern, long start)
Not supported.int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
void
reset()
OutputStream
setBinaryStream(long pos)
In this method is not supported byBlobValue
int
setBytes(long pos, byte[] bytes)
In this method is not supported byBlobValue
int
setBytes(long pos, byte[] bytes, int offset, int len)
In this method is not supported byBlobValue
long
skip(long nBytes)
void
truncate(long len)
In this method is not supported byBlobValue
-
Methods inherited from class java.io.InputStream
close, nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
-
-
-
Constructor Detail
-
BlobValue
public BlobValue(byte[] bytes)
-
BlobValue
public BlobValue(InputStream stream, long nBytes)
-
-
Method Detail
-
getStreamLength
public static int getStreamLength(InputStream value) throws SQLException
- Throws:
SQLException
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- Throws:
IOException
-
getBinaryStream
public InputStream getBinaryStream()
- Specified by:
getBinaryStream
in interfaceBlob
-
getBytes
public byte[] getBytes(long pos, int length) throws SQLException
- Specified by:
getBytes
in interfaceBlob
- Throws:
SQLException
-
getContents
public void getContents(ByteBuffer buf) throws IOException
Called from within...- Parameters:
buf
- a buffer that reflects the internally allocated bytea buffer. This size of this buffer will be exactly the size returned by a call tolength()
.- Throws:
IOException
-
mark
public void mark(int readLimit)
- Overrides:
mark
in classInputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classInputStream
-
position
public long position(Blob pattern, long start)
Not supported.
-
position
public long position(byte[] pattern, long start)
Not supported.
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
reset
public void reset() throws IOException
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
setBinaryStream
public OutputStream setBinaryStream(long pos)
In this method is not supported byBlobValue
- Specified by:
setBinaryStream
in interfaceBlob
-
setBytes
public int setBytes(long pos, byte[] bytes)
In this method is not supported byBlobValue
-
setBytes
public int setBytes(long pos, byte[] bytes, int offset, int len)
In this method is not supported byBlobValue
-
skip
public long skip(long nBytes) throws IOException
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
truncate
public void truncate(long len)
In this method is not supported byBlobValue
-
getBinaryStream
public InputStream getBinaryStream(long pos, long length) throws SQLException
- Specified by:
getBinaryStream
in interfaceBlob
- Throws:
SQLException
-
free
public void free() throws SQLException
- Specified by:
free
in interfaceBlob
- Throws:
SQLException
-
-