WORK AROUND
import java.io.LineNumberReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.FileInputStream;
import java.io.PushbackInputStream;
import java.util.zip.GZIPInputStream;
public class test extends GZIPInputStream {
public test(InputStream is)
throws java.io.IOException {
super(is);
}
public int readConcatGZ()
throws java.io.IOException {
//send in file path as arg[0]
InputStreamReader isr = new InputStreamReader(this);
LineNumberReader lnr = new LineNumberReader(isr);
String line;
while((line = lnr.readLine()) != null) {
System.out.println(line);
}
int rem = inf.getRemaining();
rem -= 8;
if (rem > 1){
((PushbackInputStream) in).unread(buf,len-rem,rem);
inf.reset();
}
return rem;
}
public static void main (String[] args) {
try{
FileInputStream fis = new FileInputStream( args[0] );
PushbackInputStream pis = new PushbackInputStream(fis, 1024);
int n;
do{
test t = new test(pis);
n = t.readConcatGZ();
}while(n > 0);
}
catch(Throwable e){
System.err.println(e);
e.printStackTrace();
}
}
}
|