diff --git a/build.gradle b/build.gradle index ae057e1..b1c2609 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ repositories { } group = 'com.github.markrileybot.heatshrink' -version = '0.1.0' +version = '0.1.1' dependencies { testCompile 'junit:junit:4.12' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index feed115..36084fe 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip diff --git a/src/main/java/heatshrink/HsInputStream.java b/src/main/java/heatshrink/HsInputStream.java index 3e186f6..2677fc4 100644 --- a/src/main/java/heatshrink/HsInputStream.java +++ b/src/main/java/heatshrink/HsInputStream.java @@ -315,7 +315,7 @@ public long skipRaw(long n) throws IOException { * @exception IOException if an I/O error occurs. */ public int available() throws IOException { - return in.available(); + return inputBufferLen - inputBufferPos + in.available(); } /** diff --git a/src/test/java/heatshrink/HsInputStreamTest.java b/src/test/java/heatshrink/HsInputStreamTest.java index e71cb7f..9eda7cf 100644 --- a/src/test/java/heatshrink/HsInputStreamTest.java +++ b/src/test/java/heatshrink/HsInputStreamTest.java @@ -40,6 +40,10 @@ public void testAvailable() throws IOException { try(HsInputStream hsi = new HsInputStream(new ByteArrayInputStream(new byte[] {1,2,3}))) { Assert.assertEquals(3, hsi.available()); } + try(HsInputStream hsi = new HsInputStream(new ByteArrayInputStream(new byte[] {1,2,3}))) { + hsi.ensureAvailable(16); + Assert.assertEquals(3, hsi.available()); + } } @Test