public static SeekableStream maybeBufferedSeekableStream(final SeekableStream stream) { return maybeBufferedSeekableStream(stream, Defaults.BUFFER_SIZE); }
public static SeekableStream maybeBufferedSeekableStream(final SeekableStream stream) { return maybeBufferedSeekableStream(stream, Defaults.BUFFER_SIZE); }
public static SeekableStream maybeBufferedSeekableStream(final SeekableStream stream) { return maybeBufferedSeekableStream(stream, Defaults.BUFFER_SIZE); }
public static SeekableStream maybeBufferedSeekableStream(final URL url) { return maybeBufferedSeekableStream(new SeekableHTTPStream(url)); }
public static SeekableStream maybeBufferedSeekableStream(final URL url) { return maybeBufferedSeekableStream(new SeekableHTTPStream(url)); }
public static SeekableStream maybeBufferedSeekableStream(final URL url) { return maybeBufferedSeekableStream(new SeekableHTTPStream(url)); }
public static SeekableStream maybeBufferedSeekableStream(final File file) { try { return maybeBufferedSeekableStream(new SeekableFileStream(file)); } catch (final FileNotFoundException e) { throw new RuntimeIOException(e); } }
public static SeekableStream maybeBufferedSeekableStream(final File file) { try { return maybeBufferedSeekableStream(new SeekableFileStream(file)); } catch (final FileNotFoundException e) { throw new RuntimeIOException(e); } }
public static SeekableStream maybeBufferedSeekableStream(final File file) { try { return maybeBufferedSeekableStream(new SeekableFileStream(file)); } catch (final FileNotFoundException e) { throw new RuntimeIOException(e); } }
public static long getNumberOfClusters(final File file) { InputStream stream = null; try { if (isBlockGzipped(file)) stream = new BlockCompressedInputStream(IOUtil.maybeBufferedSeekableStream(file)); else if (isGzipped(file)) stream = new GZIPInputStream(IOUtil.maybeBufferInputStream(new FileInputStream(file))); else stream = IOUtil.maybeBufferInputStream(new FileInputStream(file)); return getNumberOfClusters(file.getAbsolutePath(), stream); } catch (final IOException ioe) { throw new PicardException("Could not open file " + file.getAbsolutePath() + " to get its cluster count: " + ioe.getMessage(), ioe); } finally { CloserUtil.close(stream); } }
InputStream open(final File file, final boolean seekable, final boolean isGzip, final boolean isBgzf) { final String filePath = file.getAbsolutePath(); try { // Open up a buffered stream to read from the file and optionally wrap it in a gzip stream if necessary if (isBgzf) { // Only BlockCompressedInputStreams can seek, and only if they are fed a SeekableStream. return new BlockCompressedInputStream(IOUtil.maybeBufferedSeekableStream(file)); } else if (isGzip) { if (seekable) { throw new IllegalArgumentException( String.format("Cannot create a seekable reader for gzip bcl: %s.", filePath) ); } return (IOUtil.maybeBufferInputStream(new GZIPInputStream(new FileInputStream(file), Defaults.BUFFER_SIZE / 2), Defaults.BUFFER_SIZE / 2)); } else { if (seekable) { throw new IllegalArgumentException( String.format("Cannot create a seekable reader for provided bcl: %s.", filePath) ); } return IOUtil.maybeBufferInputStream(new FileInputStream(file)); } } catch (final FileNotFoundException fnfe) { throw new PicardException("File not found: (" + filePath + ")", fnfe); } catch (final IOException ioe) { throw new PicardException("Error reading file: (" + filePath + ")", ioe); } }
public static long getNumberOfClusters(final File file) { InputStream stream = null; try { if (isBlockGzipped(file)) stream = new BlockCompressedInputStream(IOUtil.maybeBufferedSeekableStream(file)); else if (isGzipped(file)) stream = new GZIPInputStream(IOUtil.maybeBufferInputStream(new FileInputStream(file))); else stream = IOUtil.maybeBufferInputStream(new FileInputStream(file)); return getNumberOfClusters(file.getAbsolutePath(), stream); } catch (final IOException ioe) { throw new PicardException("Could not open file " + file.getAbsolutePath() + " to get its cluster count: " + ioe.getMessage(), ioe); } finally { CloserUtil.close(stream); } }
InputStream open(final File file, final boolean seekable, final boolean isGzip, final boolean isBgzf) { final String filePath = file.getAbsolutePath(); try { // Open up a buffered stream to read from the file and optionally wrap it in a gzip stream if necessary if (isBgzf) { // Only BlockCompressedInputStreams can seek, and only if they are fed a SeekableStream. return new BlockCompressedInputStream(IOUtil.maybeBufferedSeekableStream(file)); } else if (isGzip) { if (seekable) { throw new IllegalArgumentException( String.format("Cannot create a seekable reader for gzip bcl: %s.", filePath) ); } return (IOUtil.maybeBufferInputStream(new GZIPInputStream(new FileInputStream(file), Defaults.BUFFER_SIZE / 2), Defaults.BUFFER_SIZE / 2)); } else { if (seekable) { throw new IllegalArgumentException( String.format("Cannot create a seekable reader for provided bcl: %s.", filePath) ); } return IOUtil.maybeBufferInputStream(new FileInputStream(file)); } } catch (final FileNotFoundException fnfe) { throw new PicardException("File not found: (" + filePath + ")", fnfe); } catch (final IOException ioe) { throw new PicardException("Error reading file: (" + filePath + ")", ioe); } }
void openFile() throws IOException { final BAMIO.ReaderAndIndex r = BAMIO.openBAMAndExposeIndex(storageClient, filePath, ValidationStringency.DEFAULT_STRINGENCY); reader = r.reader; indexStream = r.index; header = reader.getFileHeader(); hasIndex = reader.hasIndex() && reader.indexing().hasBrowseableIndex(); LOG.info("Has index = " + hasIndex); if (hasIndex) { index = new BAMFileIndexImpl( IOUtil.maybeBufferedSeekableStream(indexStream),header.getSequenceDictionary()); } else { index = null; } }
void openFile() throws IOException { final BAMIO.ReaderAndIndex r = BAMIO.openBAMAndExposeIndex(storageClient, filePath, ValidationStringency.DEFAULT_STRINGENCY); reader = r.reader; indexStream = r.index; header = reader.getFileHeader(); hasIndex = reader.hasIndex() && reader.indexing().hasBrowseableIndex(); LOG.info("Has index = " + hasIndex); if (hasIndex) { index = new BAMFileIndexImpl( IOUtil.maybeBufferedSeekableStream(indexStream),header.getSequenceDictionary()); } else { index = null; } }
final SeekableStream bufferedIndexStream; if (indexDefined && indexMaybe.asUnbufferedSeekableStream() != null) { bufferedIndexStream = IOUtil.maybeBufferedSeekableStream(indexMaybe.asUnbufferedSeekableStream()); } else { IOUtil.maybeBufferedSeekableStream(data.asUnbufferedSeekableStream()), bufferedIndexStream, false,
final SeekableStream bufferedIndexStream; if (indexDefined && indexMaybe.asUnbufferedSeekableStream() != null) { bufferedIndexStream = IOUtil.maybeBufferedSeekableStream(indexMaybe.asUnbufferedSeekableStream()); } else { IOUtil.maybeBufferedSeekableStream(data.asUnbufferedSeekableStream()), bufferedIndexStream, false, IOUtil.maybeBufferedSeekableStream(indexMaybe.asUnbufferedSeekableStream()) : null; primitiveSamReader = new CRAMFileReader( IOUtil.maybeBufferedSeekableStream(data.asUnbufferedSeekableStream()), bufferedIndexStream, referenceSource, validationStringency); } else {
final SeekableStream bufferedIndexStream; if (indexDefined && indexMaybe.asUnbufferedSeekableStream() != null) { bufferedIndexStream = IOUtil.maybeBufferedSeekableStream(indexMaybe.asUnbufferedSeekableStream()); } else { IOUtil.maybeBufferedSeekableStream(data.asUnbufferedSeekableStream()), bufferedIndexStream, false, IOUtil.maybeBufferedSeekableStream(indexMaybe.asUnbufferedSeekableStream()) : null; primitiveSamReader = new CRAMFileReader( IOUtil.maybeBufferedSeekableStream(data.asUnbufferedSeekableStream()), bufferedIndexStream, referenceSource, validationStringency); } else {