Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
language: scala
scala:
- 2.11.1
- 2.11.7

sudo: false

jdk:
- openjdk6
- openjdk7
- oraclejdk7

branches:
only:
- master
- develop
- oraclejdk8

script: ./sbt test

2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sbt.version=0.13.8
sbt.version=0.13.9

21 changes: 19 additions & 2 deletions src/main/java/org/xerial/snappy/SnappyInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down