/** * Writes a byte array to the output buffer * * @param bytes value to write */ public void writeBytes(final byte[] bytes) { writeBytes(bytes, 0, bytes.length); }
/** * Writes a byte array to the output buffer * * @param bytes value to write */ public void writeBytes(final byte[] bytes) { writeBytes(bytes, 0, bytes.length); }
/** * Writes a byte array to the output buffer * * @param bytes value to write */ public void writeBytes(final byte[] bytes) { writeBytes(bytes, 0, bytes.length); }
/** * Write whatever has been put into the byte buffer * @param numBytes -- how much to write. Note that in case of writing an unsigned value, * more bytes were put into the ByteBuffer than will get written out. */ private void writeByteBuffer(final int numBytes) { assert(numBytes <= byteBuffer.limit()); writeBytes(byteBuffer.array(), 0, numBytes); }
/** * Write whatever has been put into the byte buffer * @param numBytes -- how much to write. Note that in case of writing an unsigned value, * more bytes were put into the ByteBuffer than will get written out. */ private void writeByteBuffer(final int numBytes) { assert(numBytes <= byteBuffer.limit()); writeBytes(byteBuffer.array(), 0, numBytes); }
/** * Write whatever has been put into the byte buffer * @param numBytes -- how much to write. Note that in case of writing an unsigned value, * more bytes were put into the ByteBuffer than will get written out. */ private void writeByteBuffer(final int numBytes) { assert(numBytes <= byteBuffer.limit()); writeBytes(byteBuffer.array(), 0, numBytes); }
private void writeHeader() { // magic string final byte[] magic = BAMFileConstants.BAM_INDEX_MAGIC; codec.writeBytes(magic); codec.writeInt(nRef); }
/** * Write a string to the buffer as ASCII bytes * * @param value string to write */ private void writeString(final String value) { writeBytes(StringUtil.stringToBytes(value)); }
/** * Write a string to the buffer as ASCII bytes * * @param value string to write */ private void writeString(final String value) { writeBytes(StringUtil.stringToBytes(value)); }
/** * Write a string to the buffer as ASCII bytes * * @param value string to write */ private void writeString(final String value) { writeBytes(StringUtil.stringToBytes(value)); }
private void writeHeader() { // magic string final byte[] magic = BAMFileConstants.BAM_INDEX_MAGIC; codec.writeBytes(magic); codec.writeInt(nRef); }
private void writeHeader() { // magic string final byte[] magic = BAMFileConstants.BAM_INDEX_MAGIC; codec.writeBytes(magic); codec.writeInt(nRef); }
private void writeHeader(int nRef) { // magic string final byte[] magic = BAMFileConstants.BAM_INDEX_MAGIC; codec.writeBytes(magic); codec.writeInt(nRef); }
private void writeHeader(int nRef) { // magic string final byte[] magic = BAMFileConstants.BAM_INDEX_MAGIC; codec.writeBytes(magic); codec.writeInt(nRef); }
private void writeHeader(final SAMFileHeader header) { binaryCodec.writeBytes("BAM\001".getBytes(Charset.forName("UTF8"))); final Writer sw = new StringWriter(); new SAMTextHeaderCodec().encode(sw, header); binaryCodec.writeString(sw.toString(), true, false); final SAMSequenceDictionary dict = header.getSequenceDictionary(); binaryCodec.writeInt(dict.size()); for (final SAMSequenceRecord rec : dict.getSequences()) { binaryCodec.writeString(rec.getSequenceName(), true, true); binaryCodec.writeInt (rec.getSequenceLength()); } } }
private void writeHeader(final SAMFileHeader header) { binaryCodec.writeBytes("BAM\001".getBytes(Charset.forName("UTF8"))); final Writer sw = new StringWriter(); new SAMTextHeaderCodec().encode(sw, header); binaryCodec.writeString(sw.toString(), true, false); final SAMSequenceDictionary dict = header.getSequenceDictionary(); binaryCodec.writeInt(dict.size()); for (final SAMSequenceRecord rec : dict.getSequences()) { binaryCodec.writeString(rec.getSequenceName(), true, true); binaryCodec.writeInt (rec.getSequenceLength()); } } }
private void writeHeader(final SAMFileHeader header) { binaryCodec.writeBytes("BAM\001".getBytes(Charset.forName("UTF8"))); final Writer sw = new StringWriter(); new SAMTextHeaderCodec().encode(sw, header); binaryCodec.writeString(sw.toString(), true, false); final SAMSequenceDictionary dict = header.getSequenceDictionary(); binaryCodec.writeInt(dict.size()); for (final SAMSequenceRecord rec : dict.getSequences()) { binaryCodec.writeString(rec.getSequenceName(), true, true); binaryCodec.writeInt (rec.getSequenceLength()); } } }
static void writeHeader(final BinaryCodec outputBinaryCodec, final SAMFileHeader samFileHeader, final String headerText) { outputBinaryCodec.writeBytes("BAM\1".getBytes()); // calculate and write the length of the SAM file header text and the // header text outputBinaryCodec.writeString(headerText, true, false); // write the sequences binarily. This is redundant with the text header outputBinaryCodec.writeInt(samFileHeader.getSequenceDictionary().size()); for (final SAMSequenceRecord sequenceRecord : samFileHeader.getSequenceDictionary().getSequences()) { outputBinaryCodec.writeString(sequenceRecord.getSequenceName(), true, true); outputBinaryCodec.writeInt(sequenceRecord.getSequenceLength()); } }
/** * Writes a header to a BAM file. samFileHeader and headerText are redundant - one can be used to regenerate the other but in * some instances we already have both so this allows us to save some cycles */ protected static void writeHeader(final BinaryCodec outputBinaryCodec, final SAMFileHeader samFileHeader, final String headerText) { outputBinaryCodec.writeBytes(BAMFileConstants.BAM_MAGIC); // calculate and write the length of the SAM file header text and the header text outputBinaryCodec.writeString(headerText, true, false); // write the sequences binarily. This is redundant with the text header outputBinaryCodec.writeInt(samFileHeader.getSequenceDictionary().size()); for (final SAMSequenceRecord sequenceRecord: samFileHeader.getSequenceDictionary().getSequences()) { outputBinaryCodec.writeString(sequenceRecord.getSequenceName(), true, true); outputBinaryCodec.writeInt(sequenceRecord.getSequenceLength()); } }
/** * Writes a header to a BAM file. samFileHeader and headerText are redundant - one can be used to regenerate the other but in * some instances we already have both so this allows us to save some cycles */ protected static void writeHeader(final BinaryCodec outputBinaryCodec, final SAMFileHeader samFileHeader, final String headerText) { outputBinaryCodec.writeBytes(BAMFileConstants.BAM_MAGIC); // calculate and write the length of the SAM file header text and the header text outputBinaryCodec.writeString(headerText, true, false); // write the sequences binarily. This is redundant with the text header outputBinaryCodec.writeInt(samFileHeader.getSequenceDictionary().size()); for (final SAMSequenceRecord sequenceRecord: samFileHeader.getSequenceDictionary().getSequences()) { outputBinaryCodec.writeString(sequenceRecord.getSequenceName(), true, true); outputBinaryCodec.writeInt(sequenceRecord.getSequenceLength()); } }