+ File input = new File(file.getPath() + ".bz2");
+ if (!input.exists()) input = new File(file.getPath() + ".gz");
+ if (!input.exists()) input = new File(file.getPath() + ".xz");
+ DataInputStream dis;
+ if (!input.exists()) {
+ // Fallback to uncompressed file
+ dis = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
+ } else {
+ InputStream compressedIn = new BufferedInputStream(new FileInputStream(input));
+ try {
+ InputStream in = new CompressorStreamFactory().createCompressorInputStream(compressedIn);
+ in = new ReadAheadBuffer(in, 20 * 1024 * 1024);
+ dis = new DataInputStream(in);
+ } catch (CompressorException e) {
+ throw new IOException(e);
+ }
+ }