org.postgresql.pljava.internal
Class LargeObject

java.lang.Object
  extended by org.postgresql.pljava.internal.JavaWrapper
      extended by org.postgresql.pljava.internal.LargeObject

public class LargeObject
extends JavaWrapper

The LargeObject correspons to the internal PostgreSQL LargeObjectDesc.

Author:
Thomas Hallgren

Field Summary
static int IFS_RDLOCK
          Flag returned by create(int) and open(org.postgresql.pljava.internal.Oid, int)
static int IFS_WRLOCK
          Flag returned by create(int) and open(org.postgresql.pljava.internal.Oid, int)
static int INV_READ
          Read mode flag to be passed to create(int) and open(org.postgresql.pljava.internal.Oid, int)
static int INV_WRITE
          Write mode flag to be passed to create(int) and open(org.postgresql.pljava.internal.Oid, int)
static int SEEK_CUR
          Flag to be passed to seek(long, int) denoting that the offset parameter should be treated relative to the current address.
static int SEEK_END
          Flag to be passed to seek(long, int) denoting that the offset parameter should be treated relative to the end of the data.
static int SEEK_SET
          Flag to be passed to seek(long, int) denoting that the offset parameter should be treated as an absolute address.
 
Method Summary
protected  void _free(long pointer)
          Calls the C function pfree() with the given pointer as an argument.
 void close()
           
static Oid create(int flags)
          Creates a LargeObject handle and returns the Oid of that handle.
static int drop(Oid lobjId)
           
 Oid getId()
           
 long length()
           
static LargeObject open(Oid lobjId, int flags)
           
 int read(byte[] buf)
           
 long seek(long offset, int whence)
           
 long tell()
           
 int write(byte[] buf)
           
 
Methods inherited from class org.postgresql.pljava.internal.JavaWrapper
finalize, getNativePointer
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INV_WRITE

public static final int INV_WRITE
Write mode flag to be passed to create(int) and open(org.postgresql.pljava.internal.Oid, int)

See Also:
Constant Field Values

INV_READ

public static final int INV_READ
Read mode flag to be passed to create(int) and open(org.postgresql.pljava.internal.Oid, int)

See Also:
Constant Field Values

IFS_RDLOCK

public static final int IFS_RDLOCK
Flag returned by create(int) and open(org.postgresql.pljava.internal.Oid, int)

See Also:
Constant Field Values

IFS_WRLOCK

public static final int IFS_WRLOCK
Flag returned by create(int) and open(org.postgresql.pljava.internal.Oid, int)

See Also:
Constant Field Values

SEEK_SET

public static final int SEEK_SET
Flag to be passed to seek(long, int) denoting that the offset parameter should be treated as an absolute address.

See Also:
Constant Field Values

SEEK_CUR

public static final int SEEK_CUR
Flag to be passed to seek(long, int) denoting that the offset parameter should be treated relative to the current address.

See Also:
Constant Field Values

SEEK_END

public static final int SEEK_END
Flag to be passed to seek(long, int) denoting that the offset parameter should be treated relative to the end of the data.

See Also:
Constant Field Values
Method Detail

create

public static Oid create(int flags)
                  throws SQLException
Creates a LargeObject handle and returns the Oid of that handle.

Parameters:
flags - Flags to use for creation.
Returns:
A Oid that can be used in a call to open(Oid, int) or drop(Oid).
Throws:
SQLException

open

public static LargeObject open(Oid lobjId,
                               int flags)
                        throws SQLException
Throws:
SQLException

close

public void close()
           throws SQLException
Throws:
SQLException

drop

public static int drop(Oid lobjId)
                throws SQLException
Throws:
SQLException

getId

public Oid getId()
          throws SQLException
Throws:
SQLException

length

public long length()
            throws SQLException
Throws:
SQLException

seek

public long seek(long offset,
                 int whence)
          throws SQLException
Throws:
SQLException

tell

public long tell()
          throws SQLException
Throws:
SQLException

read

public int read(byte[] buf)
         throws SQLException
Throws:
SQLException

write

public int write(byte[] buf)
          throws SQLException
Throws:
SQLException

_free

protected void _free(long pointer)
Description copied from class: JavaWrapper
Calls the C function pfree() with the given pointer as an argument. Subclasses may override this method if special handling is needed when freeing up the object.

Overrides:
_free in class JavaWrapper
Parameters:
pointer - The pointer to free.