@Override public long getPosition() { return getFilePointer(); }
@Override public long getPosition() { return getFilePointer(); }
@Override public long getPosition() { return getFilePointer(); }
@Override public void close(TaskAttemptContext ctx) throws IOException { // Don't close the codec, we don't want BlockCompressedOutputStream's // file terminator to be output. But do flush the stream. binaryCodec.getOutputStream().flush(); // Finish indexer with file length if (splittingBAMIndexer != null) { splittingBAMIndexer.finish(compressedOut.getFilePointer() >> 16); } // And close the original output. origOutput.close(); }
@Override public void close(TaskAttemptContext ctx) throws IOException { // Don't close the codec, we don't want BlockCompressedOutputStream's // file terminator to be output. But do flush the stream. binaryCodec.getOutputStream().flush(); // Finish indexer with file length if (splittingBAMIndexer != null) { splittingBAMIndexer.finish(compressedOut.getFilePointer() >> 16); } // And close the original output. origOutput.close(); }
@Override public void close(TaskAttemptContext ctx) throws IOException { // Don't close the codec, we don't want BlockCompressedOutputStream's // file terminator to be output. But do flush the stream. binaryCodec.getOutputStream().flush(); // Finish indexer with file length if (splittingBAMIndexer != null) { splittingBAMIndexer.finish(compressedOut.getFilePointer() >> 16); } // And close the original output. origOutput.close(); }
protected void writeAlignment(final SAMRecord rec) throws IOException { if (splittingBAMIndexer != null) { splittingBAMIndexer.processAlignment(compressedOut.getFilePointer()); } recordCodec.encode(rec); }
protected void writeAlignment(final SAMRecord rec) throws IOException { if (splittingBAMIndexer != null) { splittingBAMIndexer.processAlignment(compressedOut.getFilePointer()); } recordCodec.encode(rec); }
protected void writeAlignment(final SAMRecord rec) throws IOException { if (splittingBAMIndexer != null) { splittingBAMIndexer.processAlignment(compressedOut.getFilePointer()); } recordCodec.encode(rec); }
long filePosition= writer.getFilePointer(); writer.write('\n'); indexCreator.addFeature(gtf, filePosition); filePosition = writer.getFilePointer(); throw new RuntimeException("Index file exists: " + tbi); Index index = indexCreator.finalizeIndex(writer.getFilePointer()); index.writeBasedOnFeatureFile(outFile); writer.close();
private long populateMultiBlockCompressedFile(final File tempBlockCompressedFile) throws IOException { long sentinelLineOffset = -1; try (BlockCompressedOutputStream bcos = new BlockCompressedOutputStream(tempBlockCompressedFile)) { // write lines until we exceed the size of the first block (block address != 0) do { bcos.write("Write this line enough times to exceed the size or a compressed block\n".getBytes()); } while (BlockCompressedFilePointerUtil.getBlockAddress(bcos.getFilePointer()) == 0); sentinelLineOffset = bcos.getFilePointer(); // write a terminating line that is guaranteed to not be in the first block bcos.write(sentinelLine.getBytes()); } return sentinelLineOffset; } }
long filePosition= writer.getFilePointer(); filePosition = writer.getFilePointer(); continue; filePosition = writer.getFilePointer(); } catch(Exception e){ if(e.getMessage().contains("added out sequence of order") || e.getMessage().contains("Features added out of order")){ Index index = indexCreator.finalizeIndex(writer.getFilePointer()); index.writeBasedOnFeatureFile(bgzfOut); writer.close();
protected void writeAlignment(final SAMRecord alignment) { prepareToWriteAlignments(); if (bamIndexer != null) { try { final long startOffset = blockCompressedOutputStream.getFilePointer(); bamRecordCodec.encode(alignment); final long stopOffset = blockCompressedOutputStream.getFilePointer(); // set the alignment's SourceInfo and then prepare its index information alignment.setFileSource(new SAMFileSource(null, new BAMFileSpan(new Chunk(startOffset, stopOffset)))); bamIndexer.processAlignment(alignment); } catch (Exception e) { bamIndexer = null; throw new SAMException("Exception when processing alignment for BAM index " + alignment, e); } } else { bamRecordCodec.encode(alignment); } }
@Override protected void writeAlignment(final SAMRecord alignment) { prepareToWriteAlignments(); if (bamIndexer != null) { try { final long startOffset = blockCompressedOutputStream.getFilePointer(); bamRecordCodec.encode(alignment); final long stopOffset = blockCompressedOutputStream.getFilePointer(); // set the alignment's SourceInfo and then prepare its index information alignment.setFileSource(new SAMFileSource(null, new BAMFileSpan(new Chunk(startOffset, stopOffset)))); bamIndexer.processAlignment(alignment); } catch (Exception e) { bamIndexer = null; throw new SAMException("Exception when processing alignment for BAM index " + alignment, e); } } else { bamRecordCodec.encode(alignment); } }
@Override protected void writeAlignment(final SAMRecord alignment) { prepareToWriteAlignments(); if (bamIndexer != null) { try { final long startOffset = blockCompressedOutputStream.getFilePointer(); bamRecordCodec.encode(alignment); final long stopOffset = blockCompressedOutputStream.getFilePointer(); // set the alignment's SourceInfo and then prepare its index information alignment.setFileSource(new SAMFileSource(null, new BAMFileSpan(new Chunk(startOffset, stopOffset)))); bamIndexer.processAlignment(alignment); } catch (Exception e) { bamIndexer = null; throw new SAMException("Exception when processing alignment for BAM index " + alignment, e); } } else { bamRecordCodec.encode(alignment); } }