org.postgresql.pljava.jdbc
Class BlobValue

java.lang.Object
  extended by java.io.InputStream
      extended by org.postgresql.pljava.jdbc.BlobValue
All Implemented Interfaces:
Closeable, Blob

public class BlobValue
extends InputStream
implements Blob

Author:
Thomas Hallgren

Constructor Summary
BlobValue(byte[] bytes)
           
BlobValue(InputStream stream, long nBytes)
           
 
Method Summary
 int available()
           
 InputStream getBinaryStream()
           
 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(Blob pattern, long start)
          Not supported.
 long position(byte[] 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 by BlobValue
 int setBytes(long pos, byte[] bytes)
          In this method is not supported by BlobValue
 int setBytes(long pos, byte[] bytes, int offset, int len)
          In this method is not supported by BlobValue
 long skip(long nBytes)
           
 void truncate(long len)
          In this method is not supported by BlobValue
 
Methods inherited from class java.io.InputStream
close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 class InputStream
Throws:
IOException

getBinaryStream

public InputStream getBinaryStream()
Specified by:
getBinaryStream in interface Blob

getBytes

public byte[] getBytes(long pos,
                       int length)
                throws SQLException
Specified by:
getBytes in interface Blob
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 to length().
Throws:
IOException

length

public long length()
Specified by:
length in interface Blob

mark

public void mark(int readLimit)
Overrides:
mark in class InputStream

markSupported

public boolean markSupported()
Overrides:
markSupported in class InputStream

position

public long position(Blob pattern,
                     long start)
Not supported.

Specified by:
position in interface Blob

position

public long position(byte[] pattern,
                     long start)
Not supported.

Specified by:
position in interface Blob

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

reset

public void reset()
           throws IOException
Overrides:
reset in class InputStream
Throws:
IOException

setBinaryStream

public OutputStream setBinaryStream(long pos)
In this method is not supported by BlobValue

Specified by:
setBinaryStream in interface Blob

setBytes

public int setBytes(long pos,
                    byte[] bytes)
In this method is not supported by BlobValue

Specified by:
setBytes in interface Blob

setBytes

public int setBytes(long pos,
                    byte[] bytes,
                    int offset,
                    int len)
In this method is not supported by BlobValue

Specified by:
setBytes in interface Blob

skip

public long skip(long nBytes)
          throws IOException
Overrides:
skip in class InputStream
Throws:
IOException

truncate

public void truncate(long len)
In this method is not supported by BlobValue

Specified by:
truncate in interface Blob