db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1471562 - in /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types: CharStreamHeaderGenerator.java ClobStreamHeaderGenerator.java StreamHeaderGenerator.java
Date Wed, 24 Apr 2013 17:46:55 GMT
Author: rhillegas
Date: Wed Apr 24 17:46:55 2013
New Revision: 1471562

URL: http://svn.apache.org/r1471562
Log:
DERBY-6200: Encapsulate the bytes in the eof marker for character streams.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CharStreamHeaderGenerator.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/ClobStreamHeaderGenerator.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/StreamHeaderGenerator.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CharStreamHeaderGenerator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CharStreamHeaderGenerator.java?rev=1471562&r1=1471561&r2=1471562&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CharStreamHeaderGenerator.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/CharStreamHeaderGenerator.java
Wed Apr 24 17:46:55 2013
@@ -44,6 +44,9 @@ import java.io.ObjectOutput;
 public final class CharStreamHeaderGenerator
     implements StreamHeaderGenerator {
 
+    /** The Derby-specific end-of-stream marker. */
+    private static  final   byte[] DERBY_EOF_MARKER = new byte[] {(byte)0xE0, 0x00, 0x00};
+
     /** The maximum length that can be encoded by the header. */
     private static final int MAX_ENCODABLE_LENGTH = 65535;
 
@@ -56,6 +59,20 @@ public final class CharStreamHeaderGener
         return false;
     }
 
+    /** Write the EOF marker to a byte array and return the EOF marker's length */
+    public  static  int  writeEOFMarker( byte[] buffer, int offset )
+    {
+        System.arraycopy( DERBY_EOF_MARKER, 0, buffer, offset, DERBY_EOF_MARKER.length );
+        return DERBY_EOF_MARKER.length;
+    }
+
+    /** Write the EOF marker to an Object stream  and return the EOF marker's length */
+    public  static  int  writeEOFMarker( ObjectOutput out ) throws IOException
+    {
+        out.write( DERBY_EOF_MARKER );
+        return DERBY_EOF_MARKER.length;
+    }
+
     /**
      * Generates the header for the specified length and writes it into the
      * provided buffer, starting at the specified offset.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/ClobStreamHeaderGenerator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/ClobStreamHeaderGenerator.java?rev=1471562&r1=1471561&r2=1471562&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/ClobStreamHeaderGenerator.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/ClobStreamHeaderGenerator.java
Wed Apr 24 17:46:55 2013
@@ -202,9 +202,7 @@ public final class ClobStreamHeaderGener
         }
         if (!isPreDerbyTenFive.booleanValue()) {
             if (valueLength < 0) {
-                System.arraycopy(DERBY_EOF_MARKER, 0,
-                                 buffer, offset, DERBY_EOF_MARKER.length);
-                return DERBY_EOF_MARKER.length;
+                return CharStreamHeaderGenerator.writeEOFMarker( buffer, offset );
             } else {
                 return 0;
             }
@@ -228,8 +226,7 @@ public final class ClobStreamHeaderGener
         }
         if (!isPreDerbyTenFive.booleanValue()) {
             if (valueLength < 0) {
-                out.write(DERBY_EOF_MARKER);
-                return DERBY_EOF_MARKER.length;
+                return CharStreamHeaderGenerator.writeEOFMarker( out );
             } else {
                 return 0;
             }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/StreamHeaderGenerator.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/StreamHeaderGenerator.java?rev=1471562&r1=1471561&r2=1471562&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/StreamHeaderGenerator.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/StreamHeaderGenerator.java
Wed Apr 24 17:46:55 2013
@@ -28,9 +28,6 @@ import java.io.ObjectOutput;
  */
 public interface StreamHeaderGenerator {
 
-    /** The Derby-specific end-of-stream marker. */
-    byte[] DERBY_EOF_MARKER = new byte[] {(byte)0xE0, 0x00, 0x00};
-
     /**
      * Tells if the header encodes a character or byte count.
      *



Mime
View raw message