1
package org.postgresql.largeobject;
3
// IMPORTANT NOTE: This file implements the JDBC 2 version of the driver.
4
// If you make any modifications to this file, you must make sure that the
5
// changes are also made (if relevent) to the related JDBC 1 class in the
6
// org.postgresql.jdbc1 package.
15
import org.postgresql.Field;
16
import org.postgresql.largeobject.*;
17
import org.postgresql.largeobject.*;
20
* This implements the Blob interface, which is basically another way to
21
* access a LargeObject.
23
* $Id: PGblob.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
26
public class PGblob implements java.sql.Blob
28
private org.postgresql.Connection conn;
30
private LargeObject lo;
32
public PGblob(org.postgresql.Connection conn, int oid) throws SQLException
36
LargeObjectManager lom = conn.getLargeObjectAPI();
37
this.lo = lom.open(oid);
40
public long length() throws SQLException
45
public InputStream getBinaryStream() throws SQLException
47
return lo.getInputStream();
50
public byte[] getBytes(long pos, int length) throws SQLException
52
lo.seek((int)pos, LargeObject.SEEK_SET);
53
return lo.read(length);
57
* For now, this is not implemented.
59
public long position(byte[] pattern, long start) throws SQLException
61
throw org.postgresql.Driver.notImplemented();
65
* This should be simply passing the byte value of the pattern Blob
67
public long position(Blob pattern, long start) throws SQLException
69
return position(pattern.getBytes(0, (int)pattern.length()), start);