Author: tellison
Date: Mon Jun 12 05:13:42 2006
New Revision: 413642
URL: http://svn.apache.org/viewvc?rev=413642&view=rev
Log:
Code formatting and comment tidy-up.
No functional change.
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Array.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/BatchUpdateException.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Blob.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/CallableStatement.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Clob.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Connection.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/DataTruncation.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/DatabaseMetaData.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Date.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Driver.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/DriverManager.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/DriverPropertyInfo.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/ParameterMetaData.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/PreparedStatement.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Ref.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/ResultSet.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/ResultSetMetaData.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLData.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLException.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLInput.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLOutput.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLPermission.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/SQLWarning.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Savepoint.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Statement.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Struct.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Time.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Timestamp.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Types.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/ConnectionEvent.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/ConnectionEventListener.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/ConnectionPoolDataSource.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/DataSource.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/PooledConnection.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/RowSet.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/RowSetEvent.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/RowSetInternal.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/RowSetListener.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/RowSetMetaData.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/RowSetReader.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/RowSetWriter.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/XAConnection.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/XADataSource.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/transaction/InvalidTransactionException.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/transaction/TransactionRequiredException.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/transaction/TransactionRolledbackException.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/transaction/xa/XAException.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/transaction/xa/XAResource.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/transaction/xa/Xid.java
incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/common/ClassUtils.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Array.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Array.java?rev=413642&r1=413641&r2=413642&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Array.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Array.java
Mon Jun 12 05:13:42 2006
@@ -19,115 +19,113 @@
/**
* A Java representation of the SQL ARRAY type.
- *
*/
public interface Array {
- /**
- * Retrieves the contents of the SQL ARRAY value as a Java array object.
- *
- * @return A Java array containing the elements of this Array
- * @throws SQLException
- */
- public Object getArray() throws SQLException;
-
- /**
- * Returns part of the SQL ARRAY associated with this Array, starting at a
- * particular index and comprising up to count successive elements of the
- * SQL array.
- *
- * @param index
- * @param count
- * @return A Java array containing the subportion of elements of this Array
- * @throws SQLException
- */
- public Object getArray(long index, int count) throws SQLException;
-
- /**
- * Returns part of the SQL ARRAY associated with this Array, starting at a
- * particular index and comprising up to count successive elements of the
- * SQL array.
- *
- * @param index
- * @param count
- * @param map
- * @return A Java array containing the subportion of elements of this Array
- * @throws SQLException
- */
- public Object getArray(long index, int count, Map<String, Class<?>> map)
- throws SQLException;
-
- /**
- * Returns the SQL ARRAY associated with this Array.
- *
- * @param map
- * @return A Java array containing the elements of this Array
- * @throws SQLException
- */
- public Object getArray(Map<String, Class<?>> map) throws SQLException;
-
- /**
- * Returns the JDBC type of the entries in this Array's associated array.
- *
- * @return An integer constant from the java.sql.Types class
- * @throws SQLException
- */
- public int getBaseType() throws SQLException;
-
- /**
- * Returns the SQL type name of the entries in the array associated with
- * this Array.
- *
- * @return The database specific name or a fully-qualified SQL type name.
- * @throws SQLException
- */
- public String getBaseTypeName() throws SQLException;
-
- /**
- * Returns a ResultSet object which holds the entries of the SQL ARRAY
- * associated with this Array.
- *
- * @return the ResultSet
- * @throws SQLException
- */
- public ResultSet getResultSet() throws SQLException;
-
- /**
- * Returns a ResultSet object that holds the entries of a subarray,
- * beginning at a particular index and comprising up to count successive
- * entries.
- *
- * @param index
- * @param count
- * @return the ResultSet
- * @throws SQLException
- */
- public ResultSet getResultSet(long index, int count) throws SQLException;
-
- /**
- * Returns a ResultSet object that holds the entries of a subarray,
- * beginning at a particular index and comprising up to count successive
- * entries.
- *
- * @param index
- * @param count
- * @param map
- * @return the ResultSet
- * @throws SQLException
- */
- public ResultSet getResultSet(long index, int count, Map<String, Class<?>> map)
- throws SQLException;
-
- /**
- * Returns a ResultSet object which holds the entries of the SQL ARRAY
- * associated with this Array.
- *
- * @param map
- * @return the ResultSet
- * @throws SQLException
- */
- public ResultSet getResultSet(Map<String, Class<?>> map)
- throws SQLException;
-
-} // end interface Array
+ /**
+ * Retrieves the contents of the SQL ARRAY value as a Java array object.
+ *
+ * @return A Java array containing the elements of this Array
+ * @throws SQLException
+ */
+ public Object getArray() throws SQLException;
+
+ /**
+ * Returns part of the SQL ARRAY associated with this Array, starting at a
+ * particular index and comprising up to count successive elements of the
+ * SQL array.
+ *
+ * @param index
+ * @param count
+ * @return A Java array containing the subportion of elements of this Array
+ * @throws SQLException
+ */
+ public Object getArray(long index, int count) throws SQLException;
+
+ /**
+ * Returns part of the SQL ARRAY associated with this Array, starting at a
+ * particular index and comprising up to count successive elements of the
+ * SQL array.
+ *
+ * @param index
+ * @param count
+ * @param map
+ * @return A Java array containing the subportion of elements of this Array
+ * @throws SQLException
+ */
+ public Object getArray(long index, int count, Map<String, Class<?>> map)
+ throws SQLException;
+
+ /**
+ * Returns the SQL ARRAY associated with this Array.
+ *
+ * @param map
+ * @return A Java array containing the elements of this Array
+ * @throws SQLException
+ */
+ public Object getArray(Map<String, Class<?>> map) throws SQLException;
+
+ /**
+ * Returns the JDBC type of the entries in this Array's associated array.
+ *
+ * @return An integer constant from the java.sql.Types class
+ * @throws SQLException
+ */
+ public int getBaseType() throws SQLException;
+
+ /**
+ * Returns the SQL type name of the entries in the array associated with
+ * this Array.
+ *
+ * @return The database specific name or a fully-qualified SQL type name.
+ * @throws SQLException
+ */
+ public String getBaseTypeName() throws SQLException;
+
+ /**
+ * Returns a ResultSet object which holds the entries of the SQL ARRAY
+ * associated with this Array.
+ *
+ * @return the ResultSet
+ * @throws SQLException
+ */
+ public ResultSet getResultSet() throws SQLException;
+
+ /**
+ * Returns a ResultSet object that holds the entries of a subarray,
+ * beginning at a particular index and comprising up to count successive
+ * entries.
+ *
+ * @param index
+ * @param count
+ * @return the ResultSet
+ * @throws SQLException
+ */
+ public ResultSet getResultSet(long index, int count) throws SQLException;
+
+ /**
+ * Returns a ResultSet object that holds the entries of a subarray,
+ * beginning at a particular index and comprising up to count successive
+ * entries.
+ *
+ * @param index
+ * @param count
+ * @param map
+ * @return the ResultSet
+ * @throws SQLException
+ */
+ public ResultSet getResultSet(long index, int count,
+ Map<String, Class<?>> map) throws SQLException;
+
+ /**
+ * Returns a ResultSet object which holds the entries of the SQL ARRAY
+ * associated with this Array.
+ *
+ * @param map
+ * @return the ResultSet
+ * @throws SQLException
+ */
+ public ResultSet getResultSet(Map<String, Class<?>> map)
+ throws SQLException;
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/BatchUpdateException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/BatchUpdateException.java?rev=413642&r1=413641&r2=413642&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/BatchUpdateException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/BatchUpdateException.java
Mon Jun 12 05:13:42 2006
@@ -35,113 +35,111 @@
* command in the batch, not only those that executed successfully. In this
* case, the array element for any command which encountered a problem is set to
* Statement.EXECUTE_FAILED.
- *
*/
public class BatchUpdateException extends SQLException implements Serializable {
- private static final long serialVersionUID = 5977529877145521757L;
+ private static final long serialVersionUID = 5977529877145521757L;
- private int[] theUpdateCounts = null;
-
- /**
- * Creates a BatchUpdateException with the Reason, SQLState, and Update
- * Counts set to null and a Vendor Code of 0.
- */
- public BatchUpdateException() {
- super();
- } // end method BatchUpdateException()
-
- /**
- * Creates a BatchUpdateException with the Update Counts set to the supplied
- * value and the Reason, SQLState set to null and a Vendor Code of 0.
- *
- * @param updateCounts
- * the array of Update Counts to use in initialization
- */
- public BatchUpdateException(int[] updateCounts) {
- super();
- this.theUpdateCounts = updateCounts;
- } // end method BatchUpdateException(
-
- /**
- * Creates a BatchUpdateException with the Update Counts set to the supplied
- * value, the Reason set to the supplied value and SQLState set to null and
- * a Vendor Code of 0.
- *
- * @param reason
- * the initialization value for Reason
- * @param updateCounts
- * the array of Update Counts to set
- */
- public BatchUpdateException(String reason, int[] updateCounts) {
- super(reason);
- this.theUpdateCounts = updateCounts;
- } // end method BatchUpdateException(
-
- /**
- * Creates a BatchUpdateException with the Update Counts set to the supplied
- * value, the Reason set to the supplied value, the SQLState initialized to
- * the supplied value and the Vendor Code initialized to 0.
- *
- * @param reason
- * the value to use for the Reason
- * @param SQLState
- * the X/OPEN value to use for the SQLState
- * @param updateCounts
- * the array of Update Counts to set
- */
- public BatchUpdateException(String reason, String SQLState,
- int[] updateCounts) {
- super(reason, SQLState);
- this.theUpdateCounts = updateCounts;
- } // end method BatchUpdateException(
-
- /**
- * Creates a BatchUpdateException with the Update Counts set to the supplied
- * value, the Reason set to the supplied value, the SQLState initialized to
- * the supplied value and the Vendor Code set to the supplied value.
- *
- * @param reason
- * the value to use for the Reason
- * @param SQLState
- * the X/OPEN value to use for the SQLState
- * @param vendorCode
- * the value to use for the vendor error code
- * @param updateCounts
- * the array of Update Counts to set
- */
- public BatchUpdateException(String reason, String SQLState, int vendorCode,
- int[] updateCounts) {
- super(reason, SQLState, vendorCode);
- this.theUpdateCounts = updateCounts;
- } // end method BatchUpdateException(
-
- /**
- * Gets the Update Counts array.
- * <p>
- * If a batch update command fails and a BatchUpdateException is thrown, the
- * JDBC driver may continue processing the remaining commands in the batch.
- * If the driver does process more commands after the problem occurs, the
- * array returned by <code>BatchUpdateException.getUpdateCounts</code> has
- * an element for every command in the batch, not only those that executed
- * successfully. In this case, the array element for any command which
- * encountered a problem is set to Statement.EXECUTE_FAILED.
- *
- * @return an array that contains the successful update counts, before this
- * exception. Alternatively, if the driver continues to process
- * commands following an error, one of these listed items for every
- * command the batch contains:
- * <ol>
- * <li>an count of the updates</li>
- * <li><code>Statement.SUCCESS_NO_INFO</code> indicating that
the
- * command completed successfully, but the amount of altered rows is
- * not known.</li>
- * <li><code>Statement.EXECUTE_FAILED</code> indicating that the
- * command was unsuccessful.
- * </ol>
- */
- public int[] getUpdateCounts() {
- return theUpdateCounts;
- } // end method getUpdateCounts()
-} // end class BatchUpdateException
+ private int[] theUpdateCounts = null;
+ /**
+ * Creates a BatchUpdateException with the Reason, SQLState, and Update
+ * Counts set to null and a Vendor Code of 0.
+ */
+ public BatchUpdateException() {
+ super();
+ }
+
+ /**
+ * Creates a BatchUpdateException with the Update Counts set to the supplied
+ * value and the Reason, SQLState set to null and a Vendor Code of 0.
+ *
+ * @param updateCounts
+ * the array of Update Counts to use in initialization
+ */
+ public BatchUpdateException(int[] updateCounts) {
+ super();
+ this.theUpdateCounts = updateCounts;
+ }
+
+ /**
+ * Creates a BatchUpdateException with the Update Counts set to the supplied
+ * value, the Reason set to the supplied value and SQLState set to null and
+ * a Vendor Code of 0.
+ *
+ * @param reason
+ * the initialization value for Reason
+ * @param updateCounts
+ * the array of Update Counts to set
+ */
+ public BatchUpdateException(String reason, int[] updateCounts) {
+ super(reason);
+ this.theUpdateCounts = updateCounts;
+ }
+
+ /**
+ * Creates a BatchUpdateException with the Update Counts set to the supplied
+ * value, the Reason set to the supplied value, the SQLState initialized to
+ * the supplied value and the Vendor Code initialized to 0.
+ *
+ * @param reason
+ * the value to use for the Reason
+ * @param SQLState
+ * the X/OPEN value to use for the SQLState
+ * @param updateCounts
+ * the array of Update Counts to set
+ */
+ public BatchUpdateException(String reason, String SQLState,
+ int[] updateCounts) {
+ super(reason, SQLState);
+ this.theUpdateCounts = updateCounts;
+ }
+
+ /**
+ * Creates a BatchUpdateException with the Update Counts set to the supplied
+ * value, the Reason set to the supplied value, the SQLState initialized to
+ * the supplied value and the Vendor Code set to the supplied value.
+ *
+ * @param reason
+ * the value to use for the Reason
+ * @param SQLState
+ * the X/OPEN value to use for the SQLState
+ * @param vendorCode
+ * the value to use for the vendor error code
+ * @param updateCounts
+ * the array of Update Counts to set
+ */
+ public BatchUpdateException(String reason, String SQLState, int vendorCode,
+ int[] updateCounts) {
+ super(reason, SQLState, vendorCode);
+ this.theUpdateCounts = updateCounts;
+ }
+
+ /**
+ * Gets the Update Counts array.
+ * <p>
+ * If a batch update command fails and a BatchUpdateException is thrown, the
+ * JDBC driver may continue processing the remaining commands in the batch.
+ * If the driver does process more commands after the problem occurs, the
+ * array returned by <code>BatchUpdateException.getUpdateCounts</code> has
+ * an element for every command in the batch, not only those that executed
+ * successfully. In this case, the array element for any command which
+ * encountered a problem is set to Statement.EXECUTE_FAILED.
+ *
+ * @return an array that contains the successful update counts, before this
+ * exception. Alternatively, if the driver continues to process
+ * commands following an error, one of these listed items for every
+ * command the batch contains:
+ * <ol>
+ * <li>an count of the updates</li>
+ * <li><code>Statement.SUCCESS_NO_INFO</code> indicating that
the
+ * command completed successfully, but the amount of altered rows is
+ * not known.</li>
+ * <li><code>Statement.EXECUTE_FAILED</code> indicating that
the
+ * command was unsuccessful.
+ * </ol>
+ */
+ public int[] getUpdateCounts() {
+ return theUpdateCounts;
+ }
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Blob.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Blob.java?rev=413642&r1=413641&r2=413642&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Blob.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/java/sql/Blob.java
Mon Jun 12 05:13:42 2006
@@ -11,116 +11,148 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
-
-
-package java.sql;
-
-import java.io.OutputStream;
-import java.io.InputStream;
-
-/**
- * A Java interface mapping for the SQL BLOB type.
- * <p>
- * An SQL CLOB type stores a large array of bytes (binary data) as the value in a column
of a
- * database.
- * <p>
- * The java.sql.Blob interface provides methods for setting and retrieving data in the
- * Blob, for querying Clob data length, for searching for data within the Blob.
- *
- */
-public interface Blob {
-
- /**
- * Retrieves this Blob object as a binary stream.
- * @return a binary InputStream giving access to the Blob data
- * @throws SQLException if an error occurs accessing the Blob
- */
- public InputStream getBinaryStream() throws SQLException;
-
- /**
- * Gets a portion of the value of this Blob as an array of bytes.
- * @param pos the position of the first byte in the Blob to get, where the first byte
- * in the Blob hss position = 1
- * @param length the number of bytes to get
- * @return a byte array containing the data from the Blob, starting at pos and of length
up
- * to <code>length</code> bytes long
- * @throws SQLException if an error occurs accessing the Blob
- */
- public byte[] getBytes(long pos, int length) throws SQLException;
-
- /**
- * Gets the number of bytes in this Blob object.
- * @return an long value with the length of the Blob in bytes
- * @throws SQLException if an error occurs accessing the Blob
- */
- public long length() throws SQLException;
-
- /**
- * Search for the position in this Blob at which a specified pattern begins, starting
- * at a specified position within the Blob.
- * @param pattern a Blob containing the pattern of data to search for in this Blob
- * @param start the position within this Blob to start the search, where the first position
- * in the Blob is 1
- * @return a long value with the position at which the pattern begins. -1 if the pattern
- * is not found in this Blob.
- * @throws SQLException if an error occurs accessing the Blob
- */
- public long position(Blob pattern, long start) throws SQLException;
-
- /**
- * Search for the position in this Blob at which the specified pattern begins, starting
- * at a specified position within the Blob.
- * @param pattern a byte array containing the pattern of data to search for in this Blob
- * @param start the position within this Blob to start the search, where the first position
- * in the Blob is 1
- * @return a long value with the position at which the pattern begins. -1 if the pattern
- * is not found in this Blob.
- * @throws SQLException if an error occurs accessing the Blob
- */
- public long position(byte[] pattern, long start) throws SQLException;
-
- /**
- * Gets a stream that can be used to write binary data to this Blob.
- * @param pos the position within this Blob at which to start writing, where the first position
- * in the Blob is 1
- * @return a binary InputStream which can be used to write data into the Blob starting at
- * the specified position.
- * @throws SQLException if an error occurs accessing the Blob
- */
- public OutputStream setBinaryStream(long pos) throws SQLException;
-
- /**
- * Writes a specified array of bytes to this Blob.
- * object, starting at a specified position. Returns the number of bytes written.
- * @param pos the position within this Blob at which to start writing, where the first position
- * in the Blob is 1
- * @param theBytes an array of bytes to write into the Blob
- * @return an integer containing the number of bytes written to the Blob
- * @throws SQLException if an error occurs accessing the Blob
- */
- public int setBytes(long pos, byte[] theBytes) throws SQLException;
-
- /**
- * Writes a portion of a specified byte array to this Blob. Returns the number of bytes
written.
- * @param pos the position within this Blob at which to start writing, where the first position
- * in the Blob is 1
- * @param theBytes an array of bytes to write into the Blob
- * @param offset the offset into the byte array from which to start writing data - the first
- * byte in the array has offset 0.
- * @param len the length of data to write, as the number of bytes
- * @return an integer containing the number of bytes written to the Blob
- * @throws SQLException if an error occurs accessing the Blob
- */
- public int setBytes(long pos, byte[] theBytes, int offset, int len) throws SQLException;
-
- /**
- * Truncate the value of this Blob object to a specified length in bytes.
- * @param len the length of data in bytes to truncate the value of this Blob
- * @throws SQLException if an error occurs accessing the Blob
- */
- public void truncate(long len) throws SQLException;
-
-}
-
-
+ */
+
+package java.sql;
+
+import java.io.OutputStream;
+import java.io.InputStream;
+
+/**
+ * A Java interface mapping for the SQL BLOB type.
+ * <p>
+ * An SQL CLOB type stores a large array of bytes (binary data) as the value in
+ * a column of a database.
+ * <p>
+ * The java.sql.Blob interface provides methods for setting and retrieving data
+ * in the Blob, for querying Clob data length, for searching for data within the
+ * Blob.
+ */
+public interface Blob {
+
+ /**
+ * Retrieves this Blob object as a binary stream.
+ *
+ * @return a binary InputStream giving access to the Blob data
+ * @throws SQLException
+ * if an error occurs accessing the Blob
+ */
+ public InputStream getBinaryStream() throws SQLException;
+
+ /**
+ * Gets a portion of the value of this Blob as an array of bytes.
+ *
+ * @param pos
+ * the position of the first byte in the Blob to get, where the
+ * first byte in the Blob hss position = 1
+ * @param length
+ * the number of bytes to get
+ * @return a byte array containing the data from the Blob, starting at pos
+ * and of length up to <code>length</code> bytes long
+ * @throws SQLException
+ * if an error occurs accessing the Blob
+ */
+ public byte[] getBytes(long pos, int length) throws SQLException;
+
+ /**
+ * Gets the number of bytes in this Blob object.
+ *
+ * @return an long value with the length of the Blob in bytes
+ * @throws SQLException
+ * if an error occurs accessing the Blob
+ */
+ public long length() throws SQLException;
+
+ /**
+ * Search for the position in this Blob at which a specified pattern begins,
+ * starting at a specified position within the Blob.
+ *
+ * @param pattern
+ * a Blob containing the pattern of data to search for in this
+ * Blob
+ * @param start
+ * the position within this Blob to start the search, where the
+ * first position in the Blob is 1
+ * @return a long value with the position at which the pattern begins. -1 if
+ * the pattern is not found in this Blob.
+ * @throws SQLException
+ * if an error occurs accessing the Blob
+ */
+ public long position(Blob pattern, long start) throws SQLException;
+
+ /**
+ * Search for the position in this Blob at which the specified pattern
+ * begins, starting at a specified position within the Blob.
+ *
+ * @param pattern
+ * a byte array containing the pattern of data to search for in
+ * this Blob
+ * @param start
+ * the position within this Blob to start the search, where the
+ * first position in the Blob is 1
+ * @return a long value with the position at which the pattern begins. -1 if
+ * the pattern is not found in this Blob.
+ * @throws SQLException
+ * if an error occurs accessing the Blob
+ */
+ public long position(byte[] pattern, long start) throws SQLException;
+
+ /**
+ * Gets a stream that can be used to write binary data to this Blob.
+ *
+ * @param pos
+ * the position within this Blob at which to start writing, where
+ * the first position in the Blob is 1
+ * @return a binary InputStream which can be used to write data into the
+ * Blob starting at the specified position.
+ * @throws SQLException
+ * if an error occurs accessing the Blob
+ */
+ public OutputStream setBinaryStream(long pos) throws SQLException;
+
+ /**
+ * Writes a specified array of bytes to this Blob. object, starting at a
+ * specified position. Returns the number of bytes written.
+ *
+ * @param pos
+ * the position within this Blob at which to start writing, where
+ * the first position in the Blob is 1
+ * @param theBytes
+ * an array of bytes to write into the Blob
+ * @return an integer containing the number of bytes written to the Blob
+ * @throws SQLException
+ * if an error occurs accessing the Blob
+ */
+ public int setBytes(long pos, byte[] theBytes) throws SQLException;
+
+ /**
+ * Writes a portion of a specified byte array to this Blob. Returns the
+ * number of bytes written.
+ *
+ * @param pos
+ * the position within this Blob at which to start writing, where
+ * the first position in the Blob is 1
+ * @param theBytes
+ * an array of bytes to write into the Blob
+ * @param offset
+ * the offset into the byte array from which to start writing
+ * data - the first byte in the array has offset 0.
+ * @param len
+ * the length of data to write, as the number of bytes
+ * @return an integer containing the number of bytes written to the Blob
+ * @throws SQLException
+ * if an error occurs accessing the Blob
+ */
+ public int setBytes(long pos, byte[] theBytes, int offset, int len)
+ throws SQLException;
+
+ /**
+ * Truncate the value of this Blob object to a specified length in bytes.
+ *
+ * @param len
+ * the length of data in bytes to truncate the value of this Blob
+ * @throws SQLException
+ * if an error occurs accessing the Blob
+ */
+ public void truncate(long len) throws SQLException;
+}
|