[jboss-cvs] JBossAS SVN: r63479 - branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/cmp/jdbc.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 12 13:13:26 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-06-12 13:13:26 -0400 (Tue, 12 Jun 2007)
New Revision: 63479

Modified:
   branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ByteArrayBlob.java
Log:
Implement jdk1.6 methods

Modified: branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ByteArrayBlob.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ByteArrayBlob.java	2007-06-12 14:55:12 UTC (rev 63478)
+++ branches/Branch_4_2/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ByteArrayBlob.java	2007-06-12 17:13:26 UTC (rev 63479)
@@ -21,11 +21,11 @@
  */
 package org.jboss.ejb.plugins.cmp.jdbc;
 
+import java.io.ByteArrayInputStream;
 import java.io.InputStream;
-import java.io.ByteArrayInputStream;
 import java.io.OutputStream;
+import java.sql.Blob;
 import java.sql.SQLException;
-import java.sql.Blob;
 
 /**
  * The representation (mapping) in the Java<sup><font size=-2>TM</font></sup>
@@ -48,7 +48,7 @@
    /**
     * The internal buffer for the bytes of the Blob.
     */
-   private final byte[] mBytes;
+   private byte[] mBytes;
 
    public ByteArrayBlob(byte[] bytes)
    {
@@ -89,7 +89,7 @@
       return mBytes.length;
    }
 
-   public long position(Blob pattern , long start) throws SQLException
+   public long position(Blob pattern, long start) throws SQLException
    {
       return position(pattern.getBytes(0, (int)pattern.length()), start);
    }
@@ -97,12 +97,13 @@
    public long position(byte pattern[], long start) throws SQLException
    {
       // Small optimization, no need to look beyond this.
-      int max = mBytes.length - pattern.length; 
+      int max = mBytes.length - pattern.length;
 
       if (start < 0)
       {
          start = 0; // Cannot start negative, so put it at the beginning.
-      } else if (start >= mBytes.length)
+      }
+      else if (start >= mBytes.length)
       {
          return -1; // Out of bounds, start was past the end of the buffer.
       }
@@ -112,7 +113,7 @@
          return -1; // Indicate that the pattern was not found.
       }
 
-      byte first  = pattern[0];
+      byte first = pattern[0];
       int i = (int)start;
 
       while (true)
@@ -152,25 +153,33 @@
       }
    }
 
-   public OutputStream setBinaryStream(long pos)
-      throws SQLException
+   public OutputStream setBinaryStream(long pos) throws SQLException
    {
       throw new UnsupportedOperationException("ByteArrayBlob is immutable");
    }
-   public int setBytes(long pos, byte[] bytes)
-      throws SQLException
+
+   public int setBytes(long pos, byte[] bytes) throws SQLException
    {
       throw new UnsupportedOperationException("ByteArrayBlob is immutable");
    }
-   public int setBytes(long pos, byte[] bytes, int offset, int length)
-      throws SQLException
+
+   public int setBytes(long pos, byte[] bytes, int offset, int length) throws SQLException
    {
       throw new UnsupportedOperationException("ByteArrayBlob is immutable");
    }
-   public void truncate(long length)
-      throws SQLException
+
+   public void truncate(long length) throws SQLException
    {
       throw new UnsupportedOperationException("ByteArrayBlob is immutable");
    }
+
+   public void free() throws SQLException
+   {
+      mBytes = null;
+   }
+
+   public InputStream getBinaryStream(long pos, long length) throws SQLException
+   {
+      return new ByteArrayInputStream(mBytes, (int)pos, (int)length);
+   }
 }
-




More information about the jboss-cvs-commits mailing list