new SnappyCompressorInputStream(new BoundedInputStream(in, size), blockSize);
@Override protected InputStream open(InputStream containerInputStream) throws IOException { return new SnappyCompressorInputStream(containerInputStream); } }
@Override protected InputStream open(InputStream containerInputStream) throws IOException { return new SnappyCompressorInputStream(containerInputStream); } }
@Override public CompressorInputStream compressorInputStream(InputStream is) throws IOException { return new SnappyCompressorInputStream(is); }
@Override public CompressorInputStream compressorInputStream(InputStream is) throws IOException { return new SnappyCompressorInputStream(is); }
@Override public CompressorInputStream open(File compressedFile) throws IOException { InputStream is = new FileInputStream(compressedFile); try { return new SnappyCompressorInputStream(is); } catch (IOException ioe) { try { is.close(); } catch (Exception e) {} throw ioe; } }
@Override public CompressorInputStream open(File compressedFile) throws IOException { InputStream is = new FileInputStream(compressedFile); try { return new SnappyCompressorInputStream(is); } catch (IOException ioe) { try { is.close(); } catch (Exception e) {} throw ioe; } }
/** * @param stream the stream to read from, should be buffered */ @Override public CompressorInputStream getCompressorStream(InputStream stream) throws IOException { return framed ? new FramedSnappyCompressorInputStream(stream) : (CompressorInputStream) new SnappyCompressorInputStream(stream); }
/** Open an input stream to a file; do not mask IOExceptions. * If the filename is null or "-", return System.in * If the filename ends in .gz, wrap in GZIPInputStream * @param filename * @throws FileNotFoundException * @throws IOException */ static public InputStream openFileEx(String filename) throws IOException, FileNotFoundException { if ( filename == null || filename.equals("-") ) return System.in ; if ( filename.startsWith("file:") ) { filename = filename.substring("file:".length()) ; filename = IRILib.decode(filename) ; } InputStream in = new FileInputStream(filename) ; String ext = FilenameUtils.getExtension(filename); switch ( ext ) { case "": return in; case "gz": return new GZIPInputStream(in) ; case "bz2": return new BZip2CompressorInputStream(in); case "sz": return new SnappyCompressorInputStream(in); } return in ; }
/** Open an input stream to a file; do not mask IOExceptions. * If the filename is null or "-", return System.in * If the filename ends in .gz, wrap in GZIPInputStream * @param filename * @throws FileNotFoundException * @throws IOException */ static public InputStream openFileEx(String filename) throws IOException, FileNotFoundException { if ( filename == null || filename.equals("-") ) return System.in ; if ( filename.startsWith("file:") ) { filename = filename.substring("file:".length()) ; filename = IRILib.decode(filename) ; } InputStream in = new FileInputStream(filename) ; String ext = FilenameUtils.getExtension(filename); switch ( ext ) { case "": return in; case "gz": return new GZIPInputStream(in) ; case "bz2": return new BZip2CompressorInputStream(in); case "sz": return new SnappyCompressorInputStream(in); } return in ; }
new SnappyCompressorInputStream(new BoundedInputStream(in, size), blockSize);