oracle.sql
Class BFILE

java.lang.Object
  |
  +--oracle.sql.Datum
        |
        +--oracle.sql.BFILE

public class BFILE
extends Datum


Field Summary
static int MODE_READONLY
           
static int MODE_READWRITE
           
 
Method Summary
 java.io.InputStream asciiStreamValue()
          Convert to an ascii stream representation of the datum object
 void close()
          Close a previously opened external LOB.
 void closeFile()
          Close the FILE.
 boolean fileExists()
          Find out if a given BFILE (whose locator) points to a file that actually exists on the server's filesystem.
 java.io.InputStream getBinaryStream()
          Retrieve the entire BFILE as a stream.
 java.io.InputStream getBinaryStream(long pos)
          Read from the external LOB as a stream at the requested position.
 byte[] getBytes(long pos, int length)
          Return a copy of the contents of the BFILE at the requested position.
 int getBytes(long pos, int length, byte[] buf)
          Copy the contents of the BFILE at the requested position to suppied buffer.
 OracleConnection getConnection()
          Deprecated. since 9.0.0. Use getJavaSqlConnection() instead.
 java.lang.String getDirAlias()
          Gets the Bfile's directory alias.
 java.sql.Connection getJavaSqlConnection()
          Oracle extension Return the java.sql.Connection associated with the receiver.
 java.lang.String getName()
          Gets the Bfile's file name.
 boolean isConvertibleTo(java.lang.Class jClass)
          Test whether this data object can be converted to the specified Java data type.
 boolean isFileOpen()
          Find out whether a BFILE was opened with the give BFILE.
 boolean isOpen()
          Check whether the external LOB is opened.
 long length()
          The length of the BFILE in bytes.
 void open()
          Open a external LOB in the readonly mode.
 void open(int mode)
          Open a external LOB in the indicated mode.
 void openFile()
          Open the FILE.
 long position(BFILE pattern, long start)
          Determine the byte position at which the given pattern
 long position(byte[] pattern, long start)
          Determine the byte position at which the given byte pattern
 java.lang.Object toJdbc()
          Convert this data object into its default Java object type.
 
Methods inherited from class oracle.sql.Datum
bigDecimalValue, binaryStreamValue, booleanValue, byteValue, characterStreamValue, dateValue, doubleValue, equals, floatValue, getBytes, getLength, getStream, intValue, longValue, makeJdbcArray, setBytes, setShareBytes, shareBytes, stringValue, timestampValue, timeValue
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_READONLY

public static final int MODE_READONLY

MODE_READWRITE

public static final int MODE_READWRITE
Method Detail

length

public long length()
            throws java.sql.SQLException
The length of the BFILE in bytes.
Returns:
length of the BFILE in bytes

getBytes

public byte[] getBytes(long pos,
                       int length)
                throws java.sql.SQLException
Return a copy of the contents of the BFILE at the requested position.
Parameters:
pos - is the first byte of the bfile to be extracted.(1-based)
length - is the number of consecutive bytes to be copied.
Returns:
a byte array containing a portion of the BFILE

getBytes

public int getBytes(long pos,
                    int length,
                    byte[] buf)
             throws java.sql.SQLException
Copy the contents of the BFILE at the requested position to suppied buffer.
Parameters:
pos - is the first byte of the bfile to be extracted. (1-based)
length - is the number of consecutive bytes to be copied.
buf - is the buffer to had the extracted bytes.
Returns:
a byte array containing a portion of the BFILE

getBinaryStream

public java.io.InputStream getBinaryStream()
                                    throws java.sql.SQLException
Retrieve the entire BFILE as a stream.
Returns:
a stream containing the BFILE data

position

public long position(byte[] pattern,
                     long start)
              throws java.sql.SQLException
Determine the byte position at which the given byte pattern
Parameters:
pattern - is the pattern to search for.
start - is the position at which to begin searching. (1-based)
Returns:
the position at which the pattern appears, else -1.

position

public long position(BFILE pattern,
                     long start)
              throws java.sql.SQLException
Determine the byte position at which the given pattern
Parameters:
searchstr - is the pattern to search for.
start - is the position at which to begin searching. (1-based)
Returns:
the position at which the pattern appears, else -1.

getName

public java.lang.String getName()
                         throws java.sql.SQLException
Gets the Bfile's file name.
Parameters:
bfile - The Bfile for which to get the file name.
Returns:
The file name.
Throws:
java.sql.SQLException -  

getDirAlias

public java.lang.String getDirAlias()
                             throws java.sql.SQLException
Gets the Bfile's directory alias.
Parameters:
bfile - The Bfile for which to get the directory alias.
Returns:
The directory alias name.
Throws:
java.sql.SQLException -  

openFile

public void openFile()
              throws java.sql.SQLException
Open the FILE.
Parameters:
bfile - The BFILE object to be opened.
Throws:
java.sql.SQLException -  

isFileOpen

public boolean isFileOpen()
                   throws java.sql.SQLException
Find out whether a BFILE was opened with the give BFILE.
Parameters:
bfile - The Bfile to be tested.
Returns:
true if the BFILE was opened, false if it was not opened.
Throws:
java.sql.SQLException -  

fileExists

public boolean fileExists()
                   throws java.sql.SQLException
Find out if a given BFILE (whose locator) points to a file that actually exists on the server's filesystem.
Parameters:
bfile - The Bfile to be tested.
Returns:
true if the physical file exists, false if it does not exist.
Throws:
java.sql.SQLException -  

closeFile

public void closeFile()
               throws java.sql.SQLException
Close the FILE.
Parameters:
bfile - The Bfile to be closed.
Throws:
java.sql.SQLException -  

getJavaSqlConnection

public java.sql.Connection getJavaSqlConnection()
                                         throws java.sql.SQLException
Oracle extension Return the java.sql.Connection associated with the receiver. Since 9.0.0 not all Oracle JDBC connection objects are assignment compatible with oracle.jdbc.driver.OracleConnection.
Returns:
the connection
Throws:
java.sql.SQLException - if an error occurs
Since:
9.0.0

getConnection

public OracleConnection getConnection()
                               throws java.sql.SQLException
Deprecated. since 9.0.0. Use getJavaSqlConnection() instead.
Oracle extension. The OracleConnection object associated with the array.
Returns:
the connection if it is assignment compatible with oracle.jdbc.driver.OracleConnection
Throws:
java.sql.SQLException - if the connection is not assignment compatible

getBinaryStream

public java.io.InputStream getBinaryStream(long pos)
                                    throws java.sql.SQLException
Read from the external LOB as a stream at the requested position.
Parameters:
pos - is the position data to be read.
Returns:
a input stream to read data from the BFILE
Since:
8.2.0

open

public void open()
          throws java.sql.SQLException
Open a external LOB in the readonly mode. It is an error to open the same LOB twice.
Since:
8.2.0

open

public void open(int mode)
          throws java.sql.SQLException
Open a external LOB in the indicated mode. Valid modes include MODE_READONLY only. It is an error to open the same LOB twice.
Since:
8.2.0

close

public void close()
           throws java.sql.SQLException
Close a previously opened external LOB.
Since:
8.2.0

isOpen

public boolean isOpen()
               throws java.sql.SQLException
Check whether the external LOB is opened.
Returns:
true if the LOB is opened.
Since:
8.2.0

toJdbc

public java.lang.Object toJdbc()
                        throws java.sql.SQLException
Convert this data object into its default Java object type.
Returns:
this object.
Throws:
java.sql.SQLException - if any of the lower layer code throws an exception.
Overrides:
toJdbc in class Datum

isConvertibleTo

public boolean isConvertibleTo(java.lang.Class jClass)
Test whether this data object can be converted to the specified Java data type.
Parameters:
jClass - specifies the Java data type to test against.
Returns:
true if this data object is convertible to the specified Java class, and a corresponding xxxValue() method is available; otherwise, a false is returned.
Overrides:
isConvertibleTo in class Datum

asciiStreamValue

public java.io.InputStream asciiStreamValue()
                                     throws java.sql.SQLException
Convert to an ascii stream representation of the datum object
Returns:
ascii stream representation of the datum object
Throws:
SQLException, - if no ascii stream representation exists
Overrides:
asciiStreamValue in class Datum