public void finish() throws IOException { output.flush(); }
public void finish() throws IOException { output.flush(); }
public void finish() throws IOException { output.flush(); }
public void close() throws IOException { output.flush(); // don't close as we don't want to write terminator (empty gzip block) out.close(); } }
public void close() throws IOException { output.flush(); // don't close as we don't want to write terminator (empty gzip block) out.close(); } }
public void close() throws IOException { output.flush(); // don't close as we don't want to write terminator (empty gzip block) out.close(); } }
public void resetState() throws IOException { output.flush(); output = new BlockCompressedOutputStream(out, null); }
public void resetState() throws IOException { output.flush(); output = new BlockCompressedOutputStream(out, null); }
public void resetState() throws IOException { output.flush(); output = new BlockCompressedOutputStream(out, null); }
protected static void writeHeader(final OutputStream outputStream, final SAMFileHeader samFileHeader) { final BlockCompressedOutputStream blockCompressedOutputStream = new BlockCompressedOutputStream(outputStream, null); final BinaryCodec outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); writeHeader(outputBinaryCodec, samFileHeader); try { blockCompressedOutputStream.flush(); } catch (final IOException ioe) { throw new RuntimeIOException(ioe); } } }
protected static void writeHeader(final OutputStream outputStream, final SAMFileHeader samFileHeader) { final BlockCompressedOutputStream blockCompressedOutputStream = new BlockCompressedOutputStream(outputStream, null); final BinaryCodec outputBinaryCodec = new BinaryCodec(new DataOutputStream(blockCompressedOutputStream)); writeHeader(outputBinaryCodec, samFileHeader); try { blockCompressedOutputStream.flush(); } catch (final IOException ioe) { throw new RuntimeIOException(ioe); } } }
/** * close() must be called in order to flush any remaining buffered bytes. An unclosed file will likely be * defective. * */ @Override public void close() throws IOException { flush(); // For debugging... // if (numberOfThrottleBacks > 0) { // System.err.println("In BlockCompressedOutputStream, had to throttle back " + numberOfThrottleBacks + // " times for file " + codec.getOutputFileName()); // } codec.writeBytes(BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK); codec.close(); // Can't re-open something that is not a regular file, e.g. a named pipe or an output stream if (this.file == null || !this.file.isFile()) return; if (BlockCompressedInputStream.checkTermination(this.file) != BlockCompressedInputStream.FileTermination.HAS_TERMINATOR_BLOCK) { throw new IOException("Terminator block not found after closing BGZF file " + this.file); } }
/** * close() must be called in order to flush any remaining buffered bytes. An unclosed file will likely be * defective. * */ @Override public void close() throws IOException { flush(); // For debugging... // if (numberOfThrottleBacks > 0) { // System.err.println("In BlockCompressedOutputStream, had to throttle back " + numberOfThrottleBacks + // " times for file " + codec.getOutputFileName()); // } codec.writeBytes(BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK); codec.close(); // Can't re-open something that is not a regular file, e.g. a named pipe or an output stream if (this.file == null || !Files.isRegularFile(this.file)) return; if (BlockCompressedInputStream.checkTermination(this.file) != BlockCompressedInputStream.FileTermination.HAS_TERMINATOR_BLOCK) { throw new IOException("Terminator block not found after closing BGZF file " + this.file); } }
/** * close() must be called in order to flush any remaining buffered bytes. An unclosed file will likely be * defective. * */ @Override public void close() throws IOException { flush(); // For debugging... // if (numberOfThrottleBacks > 0) { // System.err.println("In BlockCompressedOutputStream, had to throttle back " + numberOfThrottleBacks + // " times for file " + codec.getOutputFileName()); // } codec.writeBytes(BlockCompressedStreamConstants.EMPTY_GZIP_BLOCK); codec.close(); // Can't re-open something that is not a regular file, e.g. a named pipe or an output stream if (this.file == null || !Files.isRegularFile(this.file)) return; if (BlockCompressedInputStream.checkTermination(this.file) != BlockCompressedInputStream.FileTermination.HAS_TERMINATOR_BLOCK) { throw new IOException("Terminator block not found after closing BGZF file " + this.file); } }
/** * Write a BAM file header to an output stream in block compressed BAM format. * @param outputStream the stream to write the BAM header to * @param samFileHeader the header to write */ public static void writeHeader(final OutputStream outputStream, final SAMFileHeader samFileHeader) { final BlockCompressedOutputStream blockCompressedOutputStream = new BlockCompressedOutputStream(outputStream, (Path)null); final BinaryCodec outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); writeHeader(outputBinaryCodec, samFileHeader); try { blockCompressedOutputStream.flush(); } catch (final IOException ioe) { throw new RuntimeIOException(ioe); } } }
/** * Write a BAM file header to an output stream in block compressed BAM format. * @param outputStream the stream to write the BAM header to * @param samFileHeader the header to write */ public static void writeHeader(final OutputStream outputStream, final SAMFileHeader samFileHeader) { final BlockCompressedOutputStream blockCompressedOutputStream = new BlockCompressedOutputStream(outputStream, (Path)null); final BinaryCodec outputBinaryCodec = new BinaryCodec(blockCompressedOutputStream); writeHeader(outputBinaryCodec, samFileHeader); try { blockCompressedOutputStream.flush(); } catch (final IOException ioe) { throw new RuntimeIOException(ioe); } } }
codec.encode(samRecord); os.flush(); OrderedByteArray bb = new OrderedByteArray(); bb.bytes = bamBAOS.toByteArray();
private List<String> writeTempBlockCompressedFileForInflaterTest( final File tempFile ) throws IOException { final List<String> linesWritten = new ArrayList<>(); try ( final BlockCompressedOutputStream bcos = new BlockCompressedOutputStream(tempFile, 5) ) { String s = "Hi, Mom!\n"; bcos.write(s.getBytes()); //Call 1 linesWritten.add(s); s = "Hi, Dad!\n"; bcos.write(s.getBytes()); //Call 2 linesWritten.add(s); bcos.flush(); final StringBuilder sb = new StringBuilder(BlockCompressedStreamConstants.DEFAULT_UNCOMPRESSED_BLOCK_SIZE * 2); s = "1234567890123456789012345678901234567890123456789012345678901234567890\n"; while ( sb.length() <= BlockCompressedStreamConstants.DEFAULT_UNCOMPRESSED_BLOCK_SIZE ) { sb.append(s); linesWritten.add(s); } bcos.write(sb.toString().getBytes()); //Call 3 } return linesWritten; }
filePosition = writer.getFilePointer(); writer.flush();
bcos.write(s.getBytes()); linesWritten.add(s); bcos.flush(); final StringBuilder sb = new StringBuilder(BlockCompressedStreamConstants.DEFAULT_UNCOMPRESSED_BLOCK_SIZE * 2); s = "1234567890123456789012345678901234567890123456789012345678901234567890\n";