Package oracle.jdbc
Interface OracleBfile
-
- All Known Implementing Classes:
BFILE
public interface OracleBfile
This interface defines methods for Oracle specific Bfile. BFILE is an Oracle proprietary data type that provides read-only access to data located outside the database tablespaces.- Since:
- 11.2.0.3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 supplied buffer.java.lang.String
getDirAlias()
Gets the Bfile's directory alias.java.lang.String
getName()
Gets the Bfile's file name.boolean
isFileOpen()
Find out whether a BFILE was openedboolean
isOpen()
Check whether the external LOB is opened.long
length()
The length of the BFILE in bytes.void
open(LargeObjectAccessMode mode)
Open an external LOB in the indicated mode.void
openFile()
Open the FILE.long
position(byte[] pattern, long start)
Determine the byte position at which the given byte patternlong
position(OracleBfile pattern, long start)
Determine the byte position at which the given pattern
-
-
-
Method Detail
-
length
long length() throws java.sql.SQLException
The length of the BFILE in bytes.- Returns:
- length of the BFILE in bytes
- Throws:
java.sql.SQLException
-
getBytes
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
- Throws:
java.sql.SQLException
-
getBytes
int getBytes(long pos, int length, byte[] buf) throws java.sql.SQLException
Copy the contents of the BFILE at the requested position to supplied 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 have the extracted bytes.- Returns:
- a byte array containing a portion of the BFILE
- Throws:
java.sql.SQLException
-
getBinaryStream
java.io.InputStream getBinaryStream() throws java.sql.SQLException
Retrieve the entire BFILE as a stream.- Returns:
- a stream containing the BFILE data
- Throws:
java.sql.SQLException
-
getBinaryStream
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 of data to be read. The first position is 1.- Returns:
- an input stream to read data from the BFILE
- Throws:
java.sql.SQLException
- Since:
- 8.2.0
-
position
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.
- Throws:
java.sql.SQLException
-
position
long position(OracleBfile pattern, long start) throws java.sql.SQLException
Determine the byte position at which the given 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.
- Throws:
java.sql.SQLException
-
getName
java.lang.String getName() throws java.sql.SQLException
Gets the Bfile's file name.- Returns:
- The file name.
- Throws:
java.sql.SQLException
-
getDirAlias
java.lang.String getDirAlias() throws java.sql.SQLException
Gets the Bfile's directory alias.- Returns:
- The directory alias name.
- Throws:
java.sql.SQLException
-
openFile
void openFile() throws java.sql.SQLException
Open the FILE.- Throws:
java.sql.SQLException
-
isFileOpen
boolean isFileOpen() throws java.sql.SQLException
Find out whether a BFILE was opened- Returns:
- true if the BFILE was opened, false if it was not opened.
- Throws:
java.sql.SQLException
-
fileExists
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.- Returns:
- true if the physical file exists, false if it does not exist.
- Throws:
java.sql.SQLException
-
closeFile
void closeFile() throws java.sql.SQLException
Close the FILE.- Throws:
java.sql.SQLException
-
open
void open(LargeObjectAccessMode mode) throws java.sql.SQLException
Open an external LOB in the indicated mode. Valid modes include MODE_READONLY only. It is an error to open the same LOB twice.- Throws:
java.sql.SQLException
- Since:
- 11.2.0.3.0
-
close
void close() throws java.sql.SQLException
Close a previously opened external LOB.- Throws:
java.sql.SQLException
- Since:
- 8.2.0
-
isOpen
boolean isOpen() throws java.sql.SQLException
Check whether the external LOB is opened.- Returns:
- true if the LOB is opened.
- Throws:
java.sql.SQLException
- Since:
- 8.2.0
-
-