diff options
author | Eugene Kliuchnikov <eustas@google.com> | 2018-06-09 11:17:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-09 11:17:13 +0200 |
commit | 8544ae858d87056c8dac55713ffe148d9c60eb93 (patch) | |
tree | 9e5da54cb72934b5998e1c460c50faf7f3b2c0a3 /java/org/brotli/wrapper/dec/Decoder.java | |
parent | 1e7ea1d8e61b7cd51149a2dd491bc86ff8ef460c (diff) | |
download | brotli-8544ae858d87056c8dac55713ffe148d9c60eb93.zip brotli-8544ae858d87056c8dac55713ffe148d9c60eb93.tar.gz brotli-8544ae858d87056c8dac55713ffe148d9c60eb93.tar.bz2 |
Update (#680)
* fix MSVC warnings
* cleanups
Diffstat (limited to 'java/org/brotli/wrapper/dec/Decoder.java')
-rw-r--r-- | java/org/brotli/wrapper/dec/Decoder.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/java/org/brotli/wrapper/dec/Decoder.java b/java/org/brotli/wrapper/dec/Decoder.java index 0326403..548c14d 100644 --- a/java/org/brotli/wrapper/dec/Decoder.java +++ b/java/org/brotli/wrapper/dec/Decoder.java @@ -15,6 +15,7 @@ import java.util.ArrayList; * Base class for InputStream / Channel implementations. */ public class Decoder { + private static final ByteBuffer EMPTY_BUFER = ByteBuffer.allocate(0); private final ReadableByteChannel source; private final DecoderJNI.Wrapper decoder; ByteBuffer buffer; @@ -87,6 +88,11 @@ public class Decoder { if (bytesRead == -1) { fail("unexpected end of input"); } + if (bytesRead == 0) { + // No input data is currently available. + buffer = EMPTY_BUFER; + return 0; + } decoder.push(bytesRead); break; |