|
@@ -126,7 +126,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
|
|
|
private int computedBlockCRC, computedCombinedCRC;
|
|
|
|
|
|
private boolean skipResult = false;// used by skipToNextMarker
|
|
|
- private static boolean skipDecompression = false;
|
|
|
+ private boolean skipDecompression = false;
|
|
|
|
|
|
// Variables used by setup* methods exclusively
|
|
|
|
|
@@ -278,12 +278,18 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
|
|
|
*/
|
|
|
public CBZip2InputStream(final InputStream in, READ_MODE readMode)
|
|
|
throws IOException {
|
|
|
+ this(in, readMode, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ private CBZip2InputStream(final InputStream in, READ_MODE readMode, boolean skipDecompression)
|
|
|
+ throws IOException {
|
|
|
|
|
|
super();
|
|
|
int blockSize = 0X39;// i.e 9
|
|
|
this.blockSize100k = blockSize - '0';
|
|
|
this.in = new BufferedInputStream(in, 1024 * 9);// >1 MB buffer
|
|
|
this.readMode = readMode;
|
|
|
+ this.skipDecompression = skipDecompression;
|
|
|
if (readMode == READ_MODE.CONTINUOUS) {
|
|
|
currentState = STATE.START_BLOCK_STATE;
|
|
|
lazyInitialization = (in.available() == 0)?true:false;
|
|
@@ -313,11 +319,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
|
|
|
*
|
|
|
*/
|
|
|
public static long numberOfBytesTillNextMarker(final InputStream in) throws IOException{
|
|
|
- CBZip2InputStream.skipDecompression = true;
|
|
|
- CBZip2InputStream anObject = null;
|
|
|
-
|
|
|
- anObject = new CBZip2InputStream(in, READ_MODE.BYBLOCK);
|
|
|
-
|
|
|
+ CBZip2InputStream anObject = new CBZip2InputStream(in, READ_MODE.BYBLOCK, true);
|
|
|
return anObject.getProcessedByteCount();
|
|
|
}
|
|
|
|
|
@@ -392,7 +394,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
|
|
|
|
|
|
if(skipDecompression){
|
|
|
changeStateToProcessABlock();
|
|
|
- CBZip2InputStream.skipDecompression = false;
|
|
|
+ skipDecompression = false;
|
|
|
}
|
|
|
|
|
|
final int hi = offs + len;
|