public class IfxSmartBlob
extends java.lang.Object
The IfxSmartBlob class provides smart large object access. This class provides open, close, read, write, and other Informix smart blob access methods.
| Modifier and Type | Class and Description |
|---|---|
static class |
IfxSmartBlob.ClobSize |
| Modifier and Type | Field and Description |
|---|---|
static int |
LO_APPEND
Indicates if the open or create mode of the smart large object is
append mode.
|
static int |
LO_BUFFER
Indicates if the open or create mode of the smart large object is
buffer.
|
static int |
LO_CLIENT_FILE
to be used in parameter flags for IFX_LO_COPY_TO_LO and IFX_LO_COPY_TO_FILE
|
static int |
LO_CURRENT_END
to be used with IfxLoLock/IfxLoUnlock
|
static int |
LO_DIRTY_READ
Indicates if the open or create mode of the smart large object is
dirty read.
|
static int |
LO_EXCLUSIVE_MODE
to be used with IfxLoLock/IfxLoUnlock
|
static int |
LO_FORWARD
Indicates if the open or create mode of the smart large object is
forward.
|
static int |
LO_LOCKALL
Indicates if the open or create mode of the smart large object is
lock all.
|
static int |
LO_LOCKRANGE
Indicates if the open or create mode of the smart large object is
lock range.
|
static int |
LO_MAX_END
to be used with IfxLoLock/IfxLoUnlock
|
static int |
LO_NOBUFFER
Indicates if the open or create mode of the smart large object is
no buffer.
|
static int |
LO_NODIRTY_READ
Indicates if the open or create mode of the smart large object is
no dirty read.
|
static int |
LO_RANDOM
Indicates if the open or create mode of the smart large object is
random.
|
static int |
LO_RDONLY
Indicates if the open or create mode of the smart large object is
read only.
|
static int |
LO_RDWR
Indicates if the open or create mode of the smart large object is
read/write.
|
static int |
LO_REVERSE
Indicates if the open or create mode of the smart large object is
reverse.
|
static int |
LO_SEEK_CUR
Indicates that seeking starts from the current position
plus the set position.
|
static int |
LO_SEEK_END
Indicates that seeking starts from the end of file
plus the set position.
|
static int |
LO_SEEK_SET
Indicates that seeking starts from the set position.
|
static int |
LO_SEQUENTIAL
Indicates if the open or create mode of the smart large object is
sequential.
|
static int |
LO_SERVER_FILE
to be used in parameter flags for IFX_LO_COPY_TO_LO and IFX_LO_COPY_TO_FILE
|
static int |
LO_SHARED_MODE
to be used with IfxLoLock/IfxLoUnlock
|
static int |
LO_WRONLY
Indicates if the open or create mode of the large object is
write only.
|
protected IfxLocator |
locator |
| Constructor and Description |
|---|
IfxSmartBlob(java.sql.Connection conn)
Creates an IfxSmartBlob object.
|
IfxSmartBlob(java.sql.Connection conn,
boolean isReadOnly) |
| Modifier and Type | Method and Description |
|---|---|
IfxSmartBlob |
disableFinalize(boolean disable) |
protected void |
finalize() |
protected int |
getHandle() |
int |
IfxLoAlter(com.informix.jdbc.IfxLob blob,
IfxLobDescriptor lodesc)
IfxLoAlter() alters this blob using the new large object
IfxLobDescriptor.
|
int |
IfxLoAlter(IfxLocator locator,
IfxLobDescriptor lodesc)
IfxLoAlter() alter the smartblob from this locator using the new
IfxLobDescriptor lodesc.
|
void |
IfxLoClose(int lofd)
Closes the smart large object referenced by the given locator.
|
IfxLobDescriptor |
IfxLoColInfo(java.lang.String name)
Gets the smart large object characteristics for the specified
column.
|
int |
IfxLoCreate(IfxLobDescriptor lodesc,
int mode,
IfxBblob blob)
Creates a new smart large object and opens it on the server.
|
int |
IfxLoCreate(IfxLobDescriptor lodesc,
int mode,
IfxCblob clob)
Creates a new large object and opens it on the server.
|
int |
IfxLoCreate(IfxLobDescriptor lodesc,
int mode,
IfxLocator locator)
Creates a new smart large object and opens it on the server.
|
int |
IfxLoFromFile(int lofd,
java.lang.String name,
int flag,
int offset,
int amount)
IfxLoFromFile() copies a smart large object from a file on server
or client into a smart large object file descriptor.
|
IfxLoStat |
IfxLoGetStat(int lofd)
Returns an IfxLoStat object, which provides statistical
information, such as the last access time, the last update status
time, the last modification time, and the reference count of the
smart large object.
|
int |
IfxLoLock(int lofd,
long offset,
int whence,
long range,
int lockmode)
IfxLoLock() lock a range of bytes in the given large object file
descriptor in a requested mode.
|
int |
IfxLoOpen(com.informix.jdbc.IfxLob blob,
int mode)
Opens the smart large object that is referenced by the specified
IfxBblob object.
|
int |
IfxLoOpen(IfxLocator locator,
int mode)
Opens the smart large object that is referenced by the specified
locator.
|
int |
IfxLoRead(int lofd,
byte[] buffer,
int nbytes)
Reads nbytes of data from the smart large object into the
give byte array.
|
int |
IfxLoRead(int lofd,
byte[] buffer,
int nbytes,
int off)
Reads nbytes of data from the smart large object into the
give byte array.
|
byte[] |
IfxLoRead(int lofd,
int nbytes)
Reads nbytes of data from the smart large object.
|
int |
IfxLoRead(int lofd,
java.io.OutputStream fout,
int nbytes)
Reads nbytes of data from the smart large object into the
file stream.
|
void |
IfxLoRelease()
Releases the smart large object resources associated with the
locator.
|
void |
IfxLoRelease(com.informix.jdbc.IfxLob blob)
Releases the smart large object resources associated with the
smart blob object.
|
void |
IfxLoRelease(IfxLocator locator)
Releases the smart large object resources associated with the
locator.
|
long |
IfxLoSize(int lofd)
Returns the size of the smart large object.
|
long |
IfxLoTell(int lofd)
Returns the current seek position, which is the offset
for the next read or write operation on the smart large object.
|
int |
IfxLoToFile(com.informix.jdbc.IfxLob blob,
java.lang.String name,
int flag)
IfxLoToFile() copies a large object blob to a file on the client
or server.
|
int |
IfxLoToFile(IfxLocator locator,
java.lang.String name,
int flag)
IfxLoToFile() copies the source locator of a large object
to a file on the client or server.
|
void |
IfxLoTruncate(int lofd,
long size)
Truncates the smart large object to the specific size.
|
int |
IfxLoUnLock(int lofd,
long offset,
int whence,
long range)
IfxLoUnLock() unlock a range of bytes in the given large object file
descriptor.
|
int |
IfxLoWrite(int lofd,
byte[] buffer)
Writes the given data into the smart large object.
|
int |
IfxLoWrite(int lofd,
byte[] buffer,
int offset,
int length) |
int |
IfxLoWrite(int lofd,
java.io.InputStream fin,
int length)
Writes the given data into the smart large object.
|
boolean |
isReadOnly() |
long |
seek(int lofd,
long offset,
int whence)
Sets the position for the next read and write operation of the
smart large object referenced by the given locator.
|
void |
setWriteStreamBufferSize(int size)
Sets the size of the buffer the driver uses when streaming data from InputStreams/Readers into Smart Large Objects
The default size is 32K
|
long |
write(int lofd,
java.io.InputStream is)
Writes the provided InputStream into this Smart Large Object
|
long |
write(int lofd,
java.io.InputStream is,
long length)
Writes the provided InputStream into this Smart Large Object
|
IfxSmartBlob.ClobSize |
writeWithConversion(int lofd,
java.io.InputStream is)
Writes data to this smart large object with character encoding conversion
|
IfxSmartBlob.ClobSize |
writeWithConversion(int lofd,
java.io.InputStream is,
long length)
Writes data to this smart large object with character encoding conversion
|
IfxSmartBlob.ClobSize |
writeWithConversion(int lofd,
java.io.Reader r)
Writes data to this smart large object with character encoding conversion
|
IfxSmartBlob.ClobSize |
writeWithConversion(int lofd,
java.io.Reader r,
long length)
Writes data to this smart large object with character encoding conversion
|
public static final int LO_APPEND
public static final int LO_WRONLY
public static final int LO_RDONLY
public static final int LO_RDWR
public static final int LO_DIRTY_READ
public static final int LO_RANDOM
public static final int LO_SEQUENTIAL
public static final int LO_FORWARD
public static final int LO_REVERSE
public static final int LO_BUFFER
public static final int LO_NOBUFFER
public static final int LO_NODIRTY_READ
public static final int LO_LOCKALL
public static final int LO_LOCKRANGE
public static final int LO_SEEK_SET
public static final int LO_SEEK_CUR
public static final int LO_SEEK_END
public static final int LO_CLIENT_FILE
public static final int LO_SERVER_FILE
public static final int LO_SHARED_MODE
public static final int LO_EXCLUSIVE_MODE
public static final int LO_MAX_END
public static final int LO_CURRENT_END
protected IfxLocator locator
public IfxSmartBlob(java.sql.Connection conn)
conn - the java.sql.Connection object for this Informix databasepublic IfxSmartBlob(java.sql.Connection conn,
boolean isReadOnly)
public void setWriteStreamBufferSize(int size)
size - size of the bufferpublic IfxLobDescriptor IfxLoColInfo(java.lang.String name) throws java.sql.SQLException
Gets the smart large object characteristics for the specified column.
name - the name of the columnjava.sql.SQLException - if there is an error accessing smart large objectIfxLobDescriptorpublic int IfxLoCreate(IfxLobDescriptor lodesc, int mode, IfxLocator locator) throws java.sql.SQLException
Creates a new smart large object and opens it on the server.
lodesc - - the large object descriptor for the smart large objectmode - - the access mode for creating the large objectlocator - - reference to where the smart large object is stored
It is populated upon successful creation of the smart large object.java.sql.SQLException - if there is an error accessing smart large objectLO_APPEND,
LO_RDONLY,
LO_WRONLY,
LO_RDWR,
IfxLobDescriptor,
IfxLocatorpublic int IfxLoCreate(IfxLobDescriptor lodesc, int mode, IfxBblob blob) throws java.sql.SQLException
Creates a new smart large object and opens it on the server.
lodesc - - the large object descriptor for the smart large objectmode - - the access mode for creating the large objectblob - - This is populated upon successful
creation of the smart large object.java.sql.SQLException - if there is an error accessing smart large objectLO_APPEND,
LO_RDONLY,
LO_WRONLY,
LO_RDWR,
IfxLobDescriptor,
IfxBblobpublic int IfxLoCreate(IfxLobDescriptor lodesc, int mode, IfxCblob clob) throws java.sql.SQLException
Creates a new large object and opens it on the server.
lodesc - - the large object descriptormode - - the access mode for creating the large objectclob - - This is populated upon successful
creation of the smart large object.java.sql.SQLException - if there is an error accessing smart large objectLO_APPEND,
LO_RDONLY,
LO_WRONLY,
LO_RDWR,
IfxLobDescriptor,
IfxCblobpublic int IfxLoOpen(IfxLocator locator, int mode) throws java.sql.SQLException
Opens the smart large object that is referenced by the specified locator.
locator - - the locator that identifies the smart blob object
to be openedmode - - the access mode for opening the smart large objectjava.sql.SQLException - if there is an error accessing smart large objectLO_APPEND,
LO_RDONLY,
LO_WRONLY,
LO_RDWRpublic int IfxLoOpen(com.informix.jdbc.IfxLob blob,
int mode)
throws java.sql.SQLException
Opens the smart large object that is referenced by the specified IfxBblob object.
blob - the IfxLob that identifies the smart blob object
to be openedmode - the access mode for opening the smart large objectjava.sql.SQLException - if there is an error accessing smart large objectLO_APPEND,
LO_RDONLY,
LO_WRONLY,
LO_RDWRpublic void IfxLoRelease()
throws java.sql.SQLException
Releases the smart large object resources associated with the locator.
java.sql.SQLException - if there is an error accessing smart large objectpublic void IfxLoRelease(IfxLocator locator) throws java.sql.SQLException
Releases the smart large object resources associated with the locator.
locator - the locator that references the smart large objectjava.sql.SQLException - if there is an error accessing smart large objectpublic void IfxLoRelease(com.informix.jdbc.IfxLob blob)
throws java.sql.SQLException
Releases the smart large object resources associated with the smart blob object.
blob - the IfxLob that identifies the smart blob object
whose locator has to be releasedjava.sql.SQLException - if there is an error accessing smart large objectpublic void IfxLoClose(int lofd)
throws java.sql.SQLException
Closes the smart large object referenced by the given locator.
lofd - the locator handle that references the smart large objectjava.sql.SQLException - if there is an error accessing smart
large objectpublic long seek(int lofd,
long offset,
int whence)
throws java.sql.SQLException
Sets the position for the next read and write operation of the smart large object referenced by the given locator.
lofd - the locator handle that references this smart large objectoffset - the offset from the location specified in the
whence parameterwhence - LO_SEEK_SET, from begining; LO_SEEK_CUR, relative from
current position; LO_SEEK_END, from the end.java.sql.SQLException - if there is an error accessing smart large objectpublic void IfxLoTruncate(int lofd,
long size)
throws java.sql.SQLException
Truncates the smart large object to the specific size.
lofd - the handle that references the smart large objectsize - the size to which the smart large object is truncatedjava.sql.SQLException - if there is an error accessing smart large objectpublic long IfxLoSize(int lofd)
throws java.sql.SQLException
Returns the size of the smart large object.
lofd - the handle that references the smart large objectjava.sql.SQLException - if there is an error accessing smart large objectpublic IfxLoStat IfxLoGetStat(int lofd) throws java.sql.SQLException
Returns an IfxLoStat object, which provides statistical information, such as the last access time, the last update status time, the last modification time, and the reference count of the smart large object.
lofd - The handle that references the smart large objectjava.sql.SQLException - if there is an error accessing smart large objectIfxLoStatprotected int getHandle()
public long IfxLoTell(int lofd)
throws java.sql.SQLException
Returns the current seek position, which is the offset for the next read or write operation on the smart large object.
lofd - the locator handle that references the smart large objectjava.sql.SQLException - if there is an error accessing smart large objectpublic byte[] IfxLoRead(int lofd,
int nbytes)
throws java.sql.SQLException
Reads nbytes of data from the smart large object.
lofd - the locator handle that references the smart large objectnbytes - the number of bytes to be readjava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoRead(int lofd,
byte[] buffer,
int nbytes)
throws java.sql.SQLException
Reads nbytes of data from the smart large object into the give byte array.
lofd - the locator handle that references the smart large objectbuffer - the buffer into which the data is readnbytes - the number of bytes of data to be readjava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoRead(int lofd,
java.io.OutputStream fout,
int nbytes)
throws java.sql.SQLException
Reads nbytes of data from the smart large object into the file stream.
lofd - the locator handle that references the smart large objectfout - the file stream into which the data is readnbytes - the number of bytes to be readjava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoRead(int lofd,
byte[] buffer,
int nbytes,
int off)
throws java.sql.SQLException
Reads nbytes of data from the smart large object into the give byte array.
lofd - the handle that references the smart large objectbuffer - the buffer into which the data is readnbytes - the number of bytes of data to be readoff - the start offset of the datajava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoWrite(int lofd,
byte[] buffer)
throws java.sql.SQLException
Writes the given data into the smart large object.
lofd - the locator handle that references the smart large objectbuffer - the data to write to the smart large objectjava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoWrite(int lofd,
byte[] buffer,
int offset,
int length)
throws java.sql.SQLException
java.sql.SQLExceptionpublic long write(int lofd,
java.io.InputStream is)
throws java.sql.SQLException
lofd - The locator handle that references the smart large objectis - The input stream from which the data is readjava.sql.SQLException - if there is an error accessing smart large objectpublic long write(int lofd,
java.io.InputStream is,
long length)
throws java.sql.SQLException
lofd - The locator handle that references the smart large objectis - The input stream from which the data is readlength - How many bytes to read from this InputStreamjava.sql.SQLException - if there is an error accessing smart large objectpublic IfxSmartBlob.ClobSize writeWithConversion(int lofd, java.io.InputStream is, long length) throws java.sql.SQLException
lofd - The locator handle that references the smart large objectis - The input stream from which the data is readlength - How many bytes to read from this InputStreamjava.sql.SQLException - if there is an error accessing smart large objectpublic IfxSmartBlob.ClobSize writeWithConversion(int lofd, java.io.Reader r, long length) throws java.sql.SQLException
lofd - The locator handle that references the smart large objectr - The Reader from which the data is readlength - How many bytes to read from this InputStreamjava.sql.SQLException - if there is an error accessing smart large objectpublic IfxSmartBlob.ClobSize writeWithConversion(int lofd, java.io.InputStream is) throws java.sql.SQLException
lofd - The locator handle that references the smart large objectis - the input stream to read fromjava.sql.SQLException - if there is an error accessing smart large objectpublic IfxSmartBlob.ClobSize writeWithConversion(int lofd, java.io.Reader r) throws java.sql.SQLException
lofd - The locator handle that references the smart large objectr - The Reader to read data fromjava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoWrite(int lofd,
java.io.InputStream fin,
int length)
throws java.sql.SQLException
Writes the given data into the smart large object.
lofd - the locator handle that references the smart large objectfin - the file stream from which the data is writtenlength - the number of bytes to be writtenjava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoLock(int lofd,
long offset,
int whence,
long range,
int lockmode)
throws java.sql.SQLException
IfxLoLock() lock a range of bytes in the given large object file descriptor in a requested mode.
lofd - - given open large object file descriptor.offset - - offset indicated by whence.whence - - indicating starting pointrange - - size of rangelockmode - - LO_SHARED_MODE or LO_EXCLUSIVE_MODEjava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoUnLock(int lofd,
long offset,
int whence,
long range)
throws java.sql.SQLException
IfxLoUnLock() unlock a range of bytes in the given large object file descriptor.
lofd - - given large object file descriptor.offset - - offset indicated by whence.whence - - indicating starting pointrange - - size of rangejava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoAlter(IfxLocator locator, IfxLobDescriptor lodesc) throws java.sql.SQLException
IfxLoAlter() alter the smartblob from this locator using the new IfxLobDescriptor lodesc.
locator - - the smartblob locatorlodesc - - the new specification.java.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoAlter(com.informix.jdbc.IfxLob blob,
IfxLobDescriptor lodesc)
throws java.sql.SQLException
IfxLoAlter() alters this blob using the new large object IfxLobDescriptor.
blob - - the smartbloblodesc - - the new specificationjava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoFromFile(int lofd,
java.lang.String name,
int flag,
int offset,
int amount)
throws java.sql.SQLException
IfxLoFromFile() copies a smart large object from a file on server or client into a smart large object file descriptor.
lofd - - an open file descriptor for the target smart
large object.name - - name of the source file on server or client.flag - - LO_SERVER_FILE or LO_CLIENT_FILEoffset - - offset into smartblob starting positionamount - - amount to copyjava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoToFile(IfxLocator locator, java.lang.String name, int flag) throws java.sql.SQLException
IfxLoToFile() copies the source locator of a large object to a file on the client or server.
locator - - source locator of large object to be copiedname - - destination of file name of the large object.flag - - LO_SERVER_FILE or LO_CLIENT_FILEjava.sql.SQLException - if there is an error accessing smart large objectpublic int IfxLoToFile(com.informix.jdbc.IfxLob blob,
java.lang.String name,
int flag)
throws java.sql.SQLException
IfxLoToFile() copies a large object blob to a file on the client or server.
blob - - source large object to be copiedname - - destination of file name of the large object.flag - - LO_SERVER_FILE or LO_CLIENT_FILEjava.sql.SQLException - if there is an error accessing smart large objectprotected void finalize()
finalize in class java.lang.Objectpublic boolean isReadOnly()
public IfxSmartBlob disableFinalize(boolean disable)