Closed
Description
I often have quite big log files, so I tested, whether I could read them as gzip'd files.
A small modification of DataReaderFactory.getDataReader() does the job :-)
public DataReader getDataReader(InputStream inStream) throws IOException {
BufferedInputStream in = new BufferedInputStream(inStream, FOUR_KB);
if (in.markSupported()) {
if (readUShortAndReset(in) == GZIPInputStream.GZIP_MAGIC) {
in = new BufferedInputStream(new GZIPInputStream(in, FOUR_KB), FOUR_KB);
}
}
private static int readUShortAndReset(final InputStream in) throws IOException {
in.mark(2);
final int b = in.read();
final int result = ((int)in.read() << 8) | b;
in.reset();
return result;
}