<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_40) on Mon Oct 21 11:07:37 UTC 2013 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>JDBCBlobFile (HSQLDB 2.2.9 API)</title> <meta name="date" content="2013-10-21"> <link rel="stylesheet" type="text/css" href="../../../javadoc.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="JDBCBlobFile (HSQLDB 2.2.9 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/JDBCBlobFile.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../org/hsqldb/jdbc/JDBCBlobClient.html" title="class in org.hsqldb.jdbc"><span class="strong">Prev Class</span></a></li> <li><a href="../../../org/hsqldb/jdbc/JDBCCallableStatement.html" title="class in org.hsqldb.jdbc"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?org/hsqldb/jdbc/JDBCBlobFile.html" target="_top">Frames</a></li> <li><a href="JDBCBlobFile.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li><a href="#field_summary">Field</a> | </li> <li><a href="#constructor_summary">Constr</a> | </li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li><a href="#field_detail">Field</a> | </li> <li><a href="#constructor_detail">Constr</a> | </li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.hsqldb.jdbc</div> <h2 title="Class JDBCBlobFile" class="title">Class JDBCBlobFile</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>org.hsqldb.jdbc.JDBCBlobFile</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd>java.sql.Blob</dd> </dl> <hr> <br> <pre>public class <span class="strong">JDBCBlobFile</span> extends java.lang.Object implements java.sql.Blob</pre> <div class="block"><!-- start Release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> Starting with 2.1, in addition to HSQLDB driver support for both client-side in-memory and remote SQL CLOB data implementations, this class is provided to expose efficient, relatively high-performance BLOB operations over client accessible files.<p> <b>Design Notes</b><p> Although it is possible to implement a transactional version of this class, the present implementation directly propagates changes to the underlying file such that changes become visible as soon as they are either implicitly or explicitly flushed to disk. <p> </div> <!-- end release-specific documentation --></div> <dl><dt><span class="strong">Since:</span></dt> <dd>HSQLDB 2.1</dd> <dt><span class="strong">Author:</span></dt> <dd>boucherb@users</dd></dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- =========== FIELD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="field_summary"> <!-- --> </a> <h3>Field Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> <caption><span>Fields</span><span class="tabEnd"> </span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>static java.lang.String</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#TEMP_FILE_PREFIX">TEMP_FILE_PREFIX</a></strong></code> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static java.lang.String</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#TEMP_FILE_SUFFIX">TEMP_FILE_SUFFIX</a></strong></code> </td> </tr> </table> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd"> </span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#JDBCBlobFile()">JDBCBlobFile</a></strong>()</code> <div class="block">Convenience constructor; equivalent to JDBCBlobFile(true);</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#JDBCBlobFile(boolean)">JDBCBlobFile</a></strong>(boolean deleteOnFree)</code> <div class="block">Constructs a new instance backed by a File object created in response to invoking File.createTempFile(TEMP_FILE_PREFIX,TEMP_FILE_SUFFIX)</div> </td> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#JDBCBlobFile(java.io.File)">JDBCBlobFile</a></strong>(java.io.File file)</code> <div class="block">Convenience constructor; equivalent to JDBCBlobFile(file, false);</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#JDBCBlobFile(java.io.File, boolean)">JDBCBlobFile</a></strong>(java.io.File file, boolean deleteOnFree)</code> <div class="block">Constructs a new instance backed by the given File object.</div> </td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd"> </span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#free()">free</a></strong>()</code> <div class="block">This method frees the <code>Blob</code> object and releases the resources that it holds.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>java.io.InputStream</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#getBinaryStream()">getBinaryStream</a></strong>()</code> <div class="block">Retrieves the <code>BLOB</code> value designated by this <code>Blob</code> instance as a stream.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>java.io.InputStream</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#getBinaryStream(long, long)">getBinaryStream</a></strong>(long pos, long length)</code> <div class="block">Returns an <code>InputStream</code> object that contains a partial <code>Blob</code> value, starting with the byte specified by pos, which is length bytes in length.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>byte[]</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#getBytes(long, int)">getBytes</a></strong>(long pos, int length)</code> <div class="block">Retrieves all or part of the <code>BLOB</code> value that this <code>Blob</code> object represents, as an array of bytes.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>java.io.File</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#getFile()">getFile</a></strong>()</code> <div class="block">Retrieves the canonical <tt>File</tt> object denoting the file that backs this BLOB.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#isDeleteOnFree()">isDeleteOnFree</a></strong>()</code> <div class="block">Retrieves whether an attempt to delete the backing file is made in response to invocation of <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#free()"><code>free()</code></a>.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>long</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#length()">length</a></strong>()</code> <div class="block">Returns the number of bytes in the <code>BLOB</code> value designated by this <code>Blob</code> object.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>long</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#position(java.sql.Blob, long)">position</a></strong>(java.sql.Blob pattern, long start)</code> <div class="block">Retrieves the byte position in the <code>BLOB</code> value designated by this <code>Blob</code> object at which <code>pattern</code> begins.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>long</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#position(byte[], long)">position</a></strong>(byte[] pattern, long start)</code> <div class="block">Retrieves the byte position at which the specified byte array <code>pattern</code> begins within the <code>BLOB</code> value that this <code>Blob</code> object represents.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>java.io.OutputStream</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#setBinaryStream(long)">setBinaryStream</a></strong>(long pos)</code> <div class="block">Retrieves a stream that can be used to write to the <code>BLOB</code> value that this <code>Blob</code> object represents.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#setBytes(long, byte[])">setBytes</a></strong>(long pos, byte[] bytes)</code> <div class="block">Writes the given array of bytes to the <code>BLOB</code> value that this <code>Blob</code> object represents, starting at position <code>pos</code>, and returns the number of bytes written.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#setBytes(long, byte[], int, int)">setBytes</a></strong>(long pos, byte[] bytes, int offset, int len)</code> <div class="block">Writes all or part of the given <code>byte</code> array to the <code>BLOB</code> value that this <code>Blob</code> object represents and returns the number of bytes written.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#setDeleteOnFree(boolean)">setDeleteOnFree</a></strong>(boolean deleteOnFree)</code> <div class="block">Assigns whether an attempt to delete the backing file is made in response to invocation of <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#free()"><code>free()</code></a>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#truncate(long)">truncate</a></strong>(long len)</code> <div class="block">Truncates the <code>BLOB</code> value that this <code>Blob</code> object represents to be <code>len</code> bytes in length.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class java.lang.Object</h3> <code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ FIELD DETAIL =========== --> <ul class="blockList"> <li class="blockList"><a name="field_detail"> <!-- --> </a> <h3>Field Detail</h3> <a name="TEMP_FILE_PREFIX"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>TEMP_FILE_PREFIX</h4> <pre>public static final java.lang.String TEMP_FILE_PREFIX</pre> <dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.hsqldb.jdbc.JDBCBlobFile.TEMP_FILE_PREFIX">Constant Field Values</a></dd></dl> </li> </ul> <a name="TEMP_FILE_SUFFIX"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>TEMP_FILE_SUFFIX</h4> <pre>public static final java.lang.String TEMP_FILE_SUFFIX</pre> <dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../constant-values.html#org.hsqldb.jdbc.JDBCBlobFile.TEMP_FILE_SUFFIX">Constant Field Values</a></dd></dl> </li> </ul> </li> </ul> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="JDBCBlobFile()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>JDBCBlobFile</h4> <pre>public JDBCBlobFile() throws java.sql.SQLException</pre> <div class="block">Convenience constructor; equivalent to JDBCBlobFile(true);</div> <dl><dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - If a file could not be created or if a security manager exists and its <code><code>SecurityManager.checkWrite(java.lang.String)</code></code> method does not allow a file to be created.</dd></dl> </li> </ul> <a name="JDBCBlobFile(boolean)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>JDBCBlobFile</h4> <pre>public JDBCBlobFile(boolean deleteOnFree) throws java.sql.SQLException</pre> <div class="block">Constructs a new instance backed by a File object created in response to invoking File.createTempFile(TEMP_FILE_PREFIX,TEMP_FILE_SUFFIX) <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>deleteOnFree</code> - Assigns whether an attempt to delete the backing file is to be made in response to invocation of <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#free()"><code>free()</code></a>.</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - If a file could not be created or if a security manager exists and its <code><code>SecurityManager.checkWrite(java.lang.String)</code></code> method does not allow a file to be created.</dd></dl> </li> </ul> <a name="JDBCBlobFile(java.io.File)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>JDBCBlobFile</h4> <pre>public JDBCBlobFile(java.io.File file) throws java.sql.SQLException</pre> <div class="block">Convenience constructor; equivalent to JDBCBlobFile(file, false);</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>file</code> - used to back this BLOB instance.</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - If an I/O error occurs, which is possible because the construction of the canonical pathname may require file system queries; if a required system property value cannot be accessed, or if a security manager exists and its <code><code>SecurityManager.checkRead(java.io.FileDescriptor)</code></code> method denies read access to the file</dd></dl> </li> </ul> <a name="JDBCBlobFile(java.io.File, boolean)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>JDBCBlobFile</h4> <pre>public JDBCBlobFile(java.io.File file, boolean deleteOnFree) throws java.sql.SQLException</pre> <div class="block">Constructs a new instance backed by the given File object.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>file</code> - used to back this BLOB instance.</dd><dd><code>deleteOnFree</code> - Assigns whether an attempt to delete the backing file is to be made in response to invocation of <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#free()"><code>free()</code></a>.</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - If an I/O error occurs, which is possible because the construction of the canonical pathname may require file system queries; if a required system property value cannot be accessed, or if a security manager exists and its <code><code>SecurityManager.checkRead(java.io.FileDescriptor)</code></code> method denies read access to the file</dd></dl> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="length()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>length</h4> <pre>public long length() throws java.sql.SQLException</pre> <div class="block">Returns the number of bytes in the <code>BLOB</code> value designated by this <code>Blob</code> object.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>length</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Returns:</span></dt><dd>length of the <code>BLOB</code> in bytes</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the length of the <code>BLOB</code></dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2</dd></dl> </li> </ul> <a name="getBytes(long, int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getBytes</h4> <pre>public byte[] getBytes(long pos, int length) throws java.sql.SQLException</pre> <div class="block">Retrieves all or part of the <code>BLOB</code> value that this <code>Blob</code> object represents, as an array of bytes. This <code>byte</code> array contains up to <code>length</code> consecutive bytes starting at position <code>pos</code>.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>getBytes</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the ordinal position of the first byte in the <code>BLOB</code> value to be extracted; the first byte is at position 1</dd><dd><code>length</code> - the number of consecutive bytes to be copied; the value for length must be 0 or greater</dd> <dt><span class="strong">Returns:</span></dt><dd>a byte array containing up to <code>length</code> consecutive bytes from the <code>BLOB</code> value designated by this <code>Blob</code> object, starting with the byte at position <code>pos</code></dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>BLOB</code> value; if pos is less than 1 or length is less than 0</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2</dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#setBytes(long, byte[])"><code>setBytes(long, byte[])</code></a></dd></dl> </li> </ul> <a name="getBinaryStream()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getBinaryStream</h4> <pre>public java.io.InputStream getBinaryStream() throws java.sql.SQLException</pre> <div class="block">Retrieves the <code>BLOB</code> value designated by this <code>Blob</code> instance as a stream.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>getBinaryStream</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Returns:</span></dt><dd>a stream containing the <code>BLOB</code> data</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>BLOB</code> value</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2</dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#setBinaryStream(long)"><code>setBinaryStream(long)</code></a></dd></dl> </li> </ul> <a name="position(byte[], long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>position</h4> <pre>public long position(byte[] pattern, long start) throws java.sql.SQLException</pre> <div class="block">Retrieves the byte position at which the specified byte array <code>pattern</code> begins within the <code>BLOB</code> value that this <code>Blob</code> object represents. The search for <code>pattern</code> begins at position <code>start</code>.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>position</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pattern</code> - the byte array for which to search</dd><dd><code>start</code> - the position at which to begin searching; the first position is 1</dd> <dt><span class="strong">Returns:</span></dt><dd>the position at which the pattern appears, else -1</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>BLOB</code> or if start is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2</dd></dl> </li> </ul> <a name="position(java.sql.Blob, long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>position</h4> <pre>public long position(java.sql.Blob pattern, long start) throws java.sql.SQLException</pre> <div class="block">Retrieves the byte position in the <code>BLOB</code> value designated by this <code>Blob</code> object at which <code>pattern</code> begins. The search begins at position <code>start</code>.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>position</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pattern</code> - the <code>Blob</code> object designating the <code>BLOB</code> value for which to search</dd><dd><code>start</code> - the position in the <code>BLOB</code> value at which to begin searching; the first position is 1</dd> <dt><span class="strong">Returns:</span></dt><dd>the position at which the pattern begins, else -1</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>BLOB</code> value or if start is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.2</dd></dl> </li> </ul> <a name="setBytes(long, byte[])"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setBytes</h4> <pre>public int setBytes(long pos, byte[] bytes) throws java.sql.SQLException</pre> <div class="block">Writes the given array of bytes to the <code>BLOB</code> value that this <code>Blob</code> object represents, starting at position <code>pos</code>, and returns the number of bytes written. The array of bytes will overwrite the existing bytes in the <code>Blob</code> object starting at the position <code>pos</code>. If the end of the <code>Blob</code> value is reached while writing the array of bytes, then the length of the <code>Blob</code> value will be increased to accommodate the extra bytes. <p> <b>Note:</b> If the value specified for <code>pos</code> is greater then the length+1 of the <code>BLOB</code> value then the behavior is undefined. Some JDBC drivers may throw a <code>SQLException</code> while other drivers may support this operation. <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> This operation affects only the content of the underlying file; it has no effect upon a value stored in a database. To propagate the updated Blob value to a database, it is required to supply the Blob instance to an updating or inserting setXXX method of a Prepared or Callable Statement, or to supply the Blob instance to an updateXXX method of an updateable ResultSet. <p> </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>setBytes</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the position in the <code>BLOB</code> object at which to start writing; the first position is 1</dd><dd><code>bytes</code> - the array of bytes to be written to the <code>BLOB</code> value that this <code>Blob</code> object represents</dd> <dt><span class="strong">Returns:</span></dt><dd>the number of bytes written</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>BLOB</code> value or if pos is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.4</dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#getBytes(long, int)"><code>getBytes(long, int)</code></a></dd></dl> </li> </ul> <a name="setBytes(long, byte[], int, int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setBytes</h4> <pre>public int setBytes(long pos, byte[] bytes, int offset, int len) throws java.sql.SQLException</pre> <div class="block">Writes all or part of the given <code>byte</code> array to the <code>BLOB</code> value that this <code>Blob</code> object represents and returns the number of bytes written. Writing starts at position <code>pos</code> in the <code>BLOB</code> value; <code>len</code> bytes from the given byte array are written. The array of bytes will overwrite the existing bytes in the <code>Blob</code> object starting at the position <code>pos</code>. If the end of the <code>Blob</code> value is reached while writing the array of bytes, then the length of the <code>Blob</code> value will be increased to accommodate the extra bytes. <p> <b>Note:</b> If the value specified for <code>pos</code> is greater then the length+1 of the <code>BLOB</code> value then the behavior is undefined. Some JDBC drivers may throw a <code>SQLException</code> while other drivers may support this operation. <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> This operation affects only the content of the underlying file; it has no effect upon a value stored in a database. To propagate the updated Blob value to a database, it is required to supply the Blob instance to an updating or inserting setXXX method of a Prepared or Callable Statement, or to supply the Blob instance to an updateXXX method of an updateable ResultSet. <p> </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>setBytes</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the position in the <code>BLOB</code> object at which to start writing; the first position is 1</dd><dd><code>bytes</code> - the array of bytes to be written to this <code>BLOB</code> object</dd><dd><code>offset</code> - the offset into the array <code>bytes</code> at which to start reading the bytes to be set</dd><dd><code>len</code> - the number of bytes to be written to the <code>BLOB</code> value from the array of bytes <code>bytes</code></dd> <dt><span class="strong">Returns:</span></dt><dd>the number of bytes written</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>BLOB</code> value or if pos is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.4</dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#getBytes(long, int)"><code>getBytes(long, int)</code></a></dd></dl> </li> </ul> <a name="setBinaryStream(long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setBinaryStream</h4> <pre>public java.io.OutputStream setBinaryStream(long pos) throws java.sql.SQLException</pre> <div class="block">Retrieves a stream that can be used to write to the <code>BLOB</code> value that this <code>Blob</code> object represents. The stream begins at position <code>pos</code>. The bytes written to the stream will overwrite the existing bytes in the <code>Blob</code> object starting at the position <code>pos</code>. If the end of the <code>Blob</code> value is reached while writing to the stream, then the length of the <code>Blob</code> value will be increased to accommodate the extra bytes. <p> <b>Note:</b> If the value specified for <code>pos</code> is greater then the length+1 of the <code>BLOB</code> value then the behavior is undefined. Some JDBC drivers may throw a <code>SQLException</code> while other drivers may support this operation. <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> Data written to the returned stream affects only the content of the underlying file; it has no effect upon a value stored in a database. To propagate the updated Blob value to a database, it is required to supply the Blob instance to an updating or inserting setXXX method of a Prepared or Callable Statement, or to supply the Blob instance to an updateXXX method of an updateable ResultSet. <p> </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>setBinaryStream</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the position in the <code>BLOB</code> value at which to start writing; the first position is 1</dd> <dt><span class="strong">Returns:</span></dt><dd>a <code>java.io.OutputStream</code> object to which data can be written</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>BLOB</code> value or if pos is less than 1</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.4</dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#getBinaryStream()"><code>getBinaryStream()</code></a></dd></dl> </li> </ul> <a name="truncate(long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>truncate</h4> <pre>public void truncate(long len) throws java.sql.SQLException</pre> <div class="block">Truncates the <code>BLOB</code> value that this <code>Blob</code> object represents to be <code>len</code> bytes in length. <p> <b>Note:</b> If the value specified for <code>pos</code> is greater then the length+1 of the <code>BLOB</code> value then the behavior is undefined. Some JDBC drivers may throw a <code>SQLException</code> while other drivers may support this operation. <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> This operation affects only the length of the underlying file; it has no effect upon a value stored in a database. To propagate the truncated Blob value to a database, it is required to supply the Blob instance to an updating or inserting setXXX method of a Prepared or Callable Statement, or to supply the Blob instance to an updateXXX method of an updateable ResultSet. <p> </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>truncate</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>len</code> - the length, in bytes, to which the <code>BLOB</code> value that this <code>Blob</code> object represents should be truncated</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if there is an error accessing the <code>BLOB</code> value or if len is less than 0</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.4</dd></dl> </li> </ul> <a name="free()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>free</h4> <pre>public void free() throws java.sql.SQLException</pre> <div class="block">This method frees the <code>Blob</code> object and releases the resources that it holds. The object is invalid once the <code>free</code> method is called. <p> After <code>free</code> has been called, any attempt to invoke a method other than <code>free</code> will result in a <code>SQLException</code> being thrown. If <code>free</code> is called multiple times, the subsequent calls to <code>free</code> are treated as a no-op. <p> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> This operation closes any input and/or output streams obtained via <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#getBinaryStream()"><code>getBinaryStream()</code></a>, <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#getBinaryStream(long, long)"><code>getBinaryStream(long, long)</code></a> or <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#setBinaryStream(long)"><code>setBinaryStream(long)</code></a>. <p> Additionally, if the property <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#isDeleteOnFree()"><code>isDeleteOnFree()</code></a> is true, then an attempt is made to delete the backing file. </div> <!-- end release-specific documentation --></div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>free</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if an error occurs releasing the Blob's resources</dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.6</dd> <dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#setDeleteOnFree(boolean)"><code>setDeleteOnFree(boolean)</code></a>, <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#isDeleteOnFree()"><code>isDeleteOnFree()</code></a></dd></dl> </li> </ul> <a name="getBinaryStream(long, long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getBinaryStream</h4> <pre>public java.io.InputStream getBinaryStream(long pos, long length) throws java.sql.SQLException</pre> <div class="block">Returns an <code>InputStream</code> object that contains a partial <code>Blob</code> value, starting with the byte specified by pos, which is length bytes in length.</div> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>getBinaryStream</code> in interface <code>java.sql.Blob</code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>pos</code> - the offset to the first byte of the partial value to be retrieved. The first byte in the <code>Blob</code> is at position 1</dd><dd><code>length</code> - the length in bytes of the partial value to be retrieved</dd> <dt><span class="strong">Returns:</span></dt><dd><code>InputStream</code> through which the partial <code>Blob</code> value can be read.</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.sql.SQLException</code> - if pos is less than 1 or if pos is greater than the number of bytes in the <code>Blob</code> or if pos + length is greater than the number of bytes in the <code>Blob</code></dd> <dd><code>SQLFeatureNotSupportedException</code> - if the JDBC driver does not support this method</dd><dt><span class="strong">Since:</span></dt> <dd>JDK 1.6</dd></dl> </li> </ul> <a name="getFile()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getFile</h4> <pre>public java.io.File getFile()</pre> <div class="block">Retrieves the canonical <tt>File</tt> object denoting the file that backs this BLOB.</div> <dl><dt><span class="strong">Returns:</span></dt><dd>the file that backs this BLOB.</dd></dl> </li> </ul> <a name="isDeleteOnFree()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isDeleteOnFree</h4> <pre>public boolean isDeleteOnFree()</pre> <div class="block">Retrieves whether an attempt to delete the backing file is made in response to invocation of <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#free()"><code>free()</code></a>.</div> <dl><dt><span class="strong">Returns:</span></dt><dd>true if backing file deletion is attempted; otherwise false.</dd></dl> </li> </ul> <a name="setDeleteOnFree(boolean)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>setDeleteOnFree</h4> <pre>public void setDeleteOnFree(boolean deleteOnFree)</pre> <div class="block">Assigns whether an attempt to delete the backing file is made in response to invocation of <a href="../../../org/hsqldb/jdbc/JDBCBlobFile.html#free()"><code>free()</code></a>.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>deleteOnFree</code> - the new value to assign</dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/JDBCBlobFile.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../org/hsqldb/jdbc/JDBCBlobClient.html" title="class in org.hsqldb.jdbc"><span class="strong">Prev Class</span></a></li> <li><a href="../../../org/hsqldb/jdbc/JDBCCallableStatement.html" title="class in org.hsqldb.jdbc"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?org/hsqldb/jdbc/JDBCBlobFile.html" target="_top">Frames</a></li> <li><a href="JDBCBlobFile.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li><a href="#field_summary">Field</a> | </li> <li><a href="#constructor_summary">Constr</a> | </li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li><a href="#field_detail">Field</a> | </li> <li><a href="#constructor_detail">Constr</a> | </li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small><i>Copyright �� 2001 - 2010 HSQL Development Group.</i></small></p> </body> </html>