avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1434916 - in /avro/trunk: CHANGES.txt lang/java/trevni/core/src/main/java/org/apache/trevni/InputBuffer.java lang/java/trevni/core/src/test/java/org/apache/trevni/TestIOBuffers.java
Date Thu, 17 Jan 2013 21:11:45 GMT
Author: cutting
Date: Thu Jan 17 21:11:45 2013
New Revision: 1434916

URL: http://svn.apache.org/viewvc?rev=1434916&view=rev
Log:
AVRO-1233. Java: Fix InputBuffer's constructor to use the specified initial position.  Contributed
by Mark Wagner.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/trevni/core/src/main/java/org/apache/trevni/InputBuffer.java
    avro/trunk/lang/java/trevni/core/src/test/java/org/apache/trevni/TestIOBuffers.java

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1434916&r1=1434915&r2=1434916&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Thu Jan 17 21:11:45 2013
@@ -23,6 +23,9 @@ Trunk (not yet released)
     AVRO-1230. avro-mapred-1.7.3-hadoop1.jar does not work with
     Hadoop 1. (tomwhite)
 
+    AVRO-1233. Java: Fix InputBuffer's constructor to use the
+    specified initial position. (Mark Wagner via cutting)
+
 Avro 1.7.3 (6 December 2012)
 
   NEW FEATURES

Modified: avro/trunk/lang/java/trevni/core/src/main/java/org/apache/trevni/InputBuffer.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/trevni/core/src/main/java/org/apache/trevni/InputBuffer.java?rev=1434916&r1=1434915&r2=1434916&view=diff
==============================================================================
--- avro/trunk/lang/java/trevni/core/src/main/java/org/apache/trevni/InputBuffer.java (original)
+++ avro/trunk/lang/java/trevni/core/src/main/java/org/apache/trevni/InputBuffer.java Thu
Jan 17 21:11:45 2013
@@ -44,6 +44,7 @@ class InputBuffer {
       this.buf = ((InputBytes)in).getBuffer();
       this.limit = (int)in.length();
       this.offset = limit;
+      this.pos = (int)position;
     } else {                                      // create new buffer
       this.buf = new byte[8192];                  // big enough for primitives
     }

Modified: avro/trunk/lang/java/trevni/core/src/test/java/org/apache/trevni/TestIOBuffers.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/trevni/core/src/test/java/org/apache/trevni/TestIOBuffers.java?rev=1434916&r1=1434915&r2=1434916&view=diff
==============================================================================
--- avro/trunk/lang/java/trevni/core/src/test/java/org/apache/trevni/TestIOBuffers.java (original)
+++ avro/trunk/lang/java/trevni/core/src/test/java/org/apache/trevni/TestIOBuffers.java Thu
Jan 17 21:11:45 2013
@@ -230,4 +230,15 @@ public class TestIOBuffers {
     in.skipValue(ValueType.BYTES);
     Assert.assertEquals(sentinel, in.readLong());
   }
+  @Test public void testInitPos() throws Exception {
+    long sentinel = Long.MAX_VALUE;
+    OutputBuffer out = new OutputBuffer();
+    out.writeValue(Integer.MAX_VALUE, ValueType.INT);
+    out.writeLong(sentinel);
+    InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray()));
+    in.readInt();
+    long pos = in.tell();
+    in = new InputBuffer(new InputBytes(out.toByteArray()), pos);
+    Assert.assertEquals(sentinel, in.readLong());
+  }
 }



Mime
View raw message