avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1145360 - in /avro/trunk: CHANGES.txt lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java lang/java/pom.xml
Date Mon, 11 Jul 2011 21:21:09 GMT
Author: cutting
Date: Mon Jul 11 21:21:09 2011
New Revision: 1145360

URL: http://svn.apache.org/viewvc?rev=1145360&view=rev
Log:
AVRO-856. Java: Update Snappy to 1.0.3-rc4.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java
    avro/trunk/lang/java/pom.xml

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1145360&r1=1145359&r2=1145360&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Mon Jul 11 21:21:09 2011
@@ -22,6 +22,8 @@ Avro 1.6.0 (unreleased)
     AVRO-844. Java: Provide better errors for null or missing record fields.
     (Bill Graham via cutting)
 
+    AVRO-856. Java: Update Snappy to 1.0.3-rc4. (cutting)
+
   BUG FIXES
 
     AVRO-845. setup.py uses Python2.7+ specific code

Modified: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java?rev=1145360&r1=1145359&r2=1145360&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java (original)
+++ avro/trunk/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java Mon Jul
11 21:21:09 2011
@@ -22,7 +22,6 @@ import java.nio.ByteBuffer;
 import java.util.zip.CRC32;
 
 import org.xerial.snappy.Snappy;
-import org.xerial.snappy.SnappyException;
 
 /** * Implements Snappy compression and decompression. */
 class SnappyCodec extends Codec {
@@ -41,41 +40,33 @@ class SnappyCodec extends Codec {
 
   @Override
   ByteBuffer compress(ByteBuffer in) throws IOException {
-    try { 
-      ByteBuffer out =
-        ByteBuffer.allocate(Snappy.maxCompressedLength(in.remaining())+4);
-      int size = Snappy.compress(in.array(), in.position(), in.remaining(),
-                                 out.array(), 0);
-      crc32.reset();
-      crc32.update(in.array(), in.position(), in.remaining());
-      out.putInt(size, (int)crc32.getValue());
-
-      out.limit(size+4);
-
-      return out;
-    } catch (SnappyException e) {
-      throw new IOException(e);
-    }
+    ByteBuffer out =
+      ByteBuffer.allocate(Snappy.maxCompressedLength(in.remaining())+4);
+    int size = Snappy.compress(in.array(), in.position(), in.remaining(),
+                               out.array(), 0);
+    crc32.reset();
+    crc32.update(in.array(), in.position(), in.remaining());
+    out.putInt(size, (int)crc32.getValue());
+
+    out.limit(size+4);
+
+    return out;
   }
 
   @Override
   ByteBuffer decompress(ByteBuffer in) throws IOException {
-    try { 
-      ByteBuffer out = ByteBuffer.allocate
-        (Snappy.uncompressedLength(in.array(),in.position(),in.remaining()-4));
-      int size = Snappy.uncompress(in.array(),in.position(),in.remaining()-4,
-                                   out.array(), 0);
-      out.limit(size);
-
-      crc32.reset();
-      crc32.update(out.array(), 0, size);
-      if (in.getInt(in.limit()-4) != (int)crc32.getValue())
-        throw new IOException("Checksum failure");
-
-      return out;
-    } catch (SnappyException e) {
-      throw new IOException(e);
-    }
+    ByteBuffer out = ByteBuffer.allocate
+      (Snappy.uncompressedLength(in.array(),in.position(),in.remaining()-4));
+    int size = Snappy.uncompress(in.array(),in.position(),in.remaining()-4,
+                                 out.array(), 0);
+    out.limit(size);
+    
+    crc32.reset();
+    crc32.update(out.array(), 0, size);
+    if (in.getInt(in.limit()-4) != (int)crc32.getValue())
+      throw new IOException("Checksum failure");
+    
+    return out;
   }
   
   @Override public int hashCode() { return getName().hashCode(); }

Modified: avro/trunk/lang/java/pom.xml
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/pom.xml?rev=1145360&r1=1145359&r2=1145360&view=diff
==============================================================================
--- avro/trunk/lang/java/pom.xml (original)
+++ avro/trunk/lang/java/pom.xml Mon Jul 11 21:21:09 2011
@@ -45,7 +45,7 @@
     <jetty-version>6.1.26</jetty-version>
     <netty-version>3.2.4.Final</netty-version> 
     <jopt-simple-version>3.2</jopt-simple-version>
-    <snappy-version>1.0.1-rc3</snappy-version>
+    <snappy-version>1.0.3-rc4</snappy-version>
   </properties>
 
   <issueManagement>



Mime
View raw message