diff --git a/build.gradle b/build.gradle index a8b2b18..36bf417 100644 --- a/build.gradle +++ b/build.gradle @@ -16,10 +16,10 @@ group = 'com.github.markrileybot.heatshrink' version = '0.0.2-SNAPSHOT' dependencies { - compile 'org.slf4j:slf4j-api:1.7.21' - testCompile 'junit:junit:4.12' - testCompile 'commons-io:commons-io:2.5' - testCompile files(sourceSets.test.resources.srcDirs) + compile 'org.slf4j:slf4j-api:1.7.21' + testCompile 'junit:junit:4.12' + testCompile 'commons-io:commons-io:2.5' + testCompile files(sourceSets.test.resources.srcDirs) } jacocoTestReport { @@ -29,18 +29,34 @@ jacocoTestReport { } } +task sourceJar(type: Jar) { + from sourceSets.main.allJava +} + +task javadocJar(type: Jar, dependsOn: 'javadoc') { + from javadoc.destinationDir +} + publishing { - publications { - MyPublication(MavenPublication) { - from components.java - } - } + publications { + mavenJava(MavenPublication) { + from components.java + + artifact sourceJar { + classifier 'sources' + } + + artifact javadocJar { + classifier 'javadoc' + } + } + } } bintray { - user = 'markrileybot' + user = 'markrileybot' key = System.getenv('BINTRAY_KEY') - publications = ['MyPublication'] + publications = ['mavenJava'] pkg { repo = 'markrileybot' name = project.name diff --git a/src/main/java/heatshrink/HsInputStream.java b/src/main/java/heatshrink/HsInputStream.java index d59b12c..86d0c73 100644 --- a/src/main/java/heatshrink/HsInputStream.java +++ b/src/main/java/heatshrink/HsInputStream.java @@ -101,7 +101,7 @@ public HsInputStream(java.io.InputStream in, int bufferSize, int windowSize, int this.window = new byte[1 << windowSize]; this.windowSize = windowSize; this.lookaheadSize = lookaheadSize; - clear(in); + clear(); } /** @@ -379,9 +379,18 @@ public boolean markSupported() { /** * Prepare this for reuse + * + * @param in A new input stream */ public void clear(InputStream in) { this.in = in; + clear(); + } + + /** + * Prepare this for reuse + */ + private void clear() { state = State.TAG_BIT; outputCount = outputIndex = 0; inputBufferPos = inputBufferLen = 0;