From 3ab90733a4fdbeace63bb9bfe7bbdb3700b9b72b Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Wed, 30 Mar 2016 16:56:53 -0700 Subject: [PATCH 1/4] Use non-JNI method for read(byte[]) --- .../org/xerial/snappy/SnappyInputStream.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/xerial/snappy/SnappyInputStream.java b/src/main/java/org/xerial/snappy/SnappyInputStream.java index a7380362..19a68c66 100755 --- a/src/main/java/org/xerial/snappy/SnappyInputStream.java +++ b/src/main/java/org/xerial/snappy/SnappyInputStream.java @@ -157,10 +157,27 @@ protected void readFully(byte[] fragment, int fragmentLength) * @see java.io.InputStream#read(byte[], int, int) */ @Override - public int read(byte[] b, int off, int len) + public int read(byte[] b, int byteOffset, int byteLength) throws IOException { - return rawRead(b, off, len); + int writtenBytes = 0; + for (; writtenBytes < byteLength; ) { + + if (uncompressedCursor >= uncompressedLimit) { + if (hasNextChunk()) { + continue; + } + else { + return writtenBytes == 0 ? -1 : writtenBytes; + } + } + int bytesToWrite = Math.min(uncompressedLimit - uncompressedCursor, byteLength - writtenBytes); + System.arraycopy(uncompressed, uncompressedCursor, b, byteOffset + writtenBytes, bytesToWrite); + writtenBytes += bytesToWrite; + uncompressedCursor += bytesToWrite; + } + + return writtenBytes; } /** From ea0128d59ff6e78de8f6cd57904488866cc1048e Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Wed, 30 Mar 2016 16:59:22 -0700 Subject: [PATCH 2/4] Enable travis build for all branches --- .travis.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c14f1061..a919cb98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,5 @@ jdk: - openjdk7 - oraclejdk7 -branches: - only: - - master - - develop - script: ./sbt test From 33f77711518baec5bc9dcc58a37c5c3411c793bc Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Wed, 30 Mar 2016 17:45:33 -0700 Subject: [PATCH 3/4] Update travis config --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a919cb98..1f80e9d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,13 @@ language: scala scala: - - 2.11.1 + - 2.11.7 + +sudo: false + jdk: - openjdk6 - openjdk7 - oraclejdk7 + - oraclejdk8 script: ./sbt test - From 939c48747a4e1f3f7df29ee9511e69d209cf7c37 Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Wed, 30 Mar 2016 17:48:51 -0700 Subject: [PATCH 4/4] Update sbt version --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 07b0ebbc..02cb92b3 100755 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1,2 @@ -sbt.version=0.13.8 +sbt.version=0.13.9