A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/chewiebug/GCViewer/issues/74 below:

Support reading GZIPInputStream log files · Issue #74 · chewiebug/GCViewer · GitHub

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;
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4