void finish(final SBIIndex.Header header, final long finalVirtualOffset) { // complete writing the temp offsets file writeVirtualOffset(finalVirtualOffset); tempOffsetsCodec.close(); try (BinaryCodec binaryCodec = new BinaryCodec(out); InputStream tempOffsets = new BufferedInputStream(Files.newInputStream(tempOffsetsFile))) { // header binaryCodec.writeBytes(SBIIndex.SBI_MAGIC); binaryCodec.writeLong(header.getFileLength()); binaryCodec.writeBytes(header.getMd5()); binaryCodec.writeBytes(header.getUuid()); binaryCodec.writeLong(header.getTotalNumberOfRecords()); binaryCodec.writeLong(header.getGranularity()); binaryCodec.writeLong(virtualOffsetCount); // offsets IOUtil.copyStream(tempOffsets, out); } catch (IOException e) { throw new RuntimeIOException(e); } finally { try { Files.delete(tempOffsetsFile); } catch (IOException e) { throw new RuntimeIOException(e); } } } }
void finish(final SBIIndex.Header header, final long finalVirtualOffset) { // complete writing the temp offsets file writeVirtualOffset(finalVirtualOffset); tempOffsetsCodec.close(); try (BinaryCodec binaryCodec = new BinaryCodec(out); InputStream tempOffsets = new BufferedInputStream(Files.newInputStream(tempOffsetsFile))) { // header binaryCodec.writeBytes(SBIIndex.SBI_MAGIC); binaryCodec.writeLong(header.getFileLength()); binaryCodec.writeBytes(header.getMd5()); binaryCodec.writeBytes(header.getUuid()); binaryCodec.writeLong(header.getTotalNumberOfRecords()); binaryCodec.writeLong(header.getGranularity()); binaryCodec.writeLong(virtualOffsetCount); // offsets IOUtil.copyStream(tempOffsets, out); } catch (IOException e) { throw new RuntimeIOException(e); } finally { try { Files.delete(tempOffsetsFile); } catch (IOException e) { throw new RuntimeIOException(e); } } } }
/** * Returns the granularity of the index, that is the number of alignments between subsequent entries in the index, * or zero if not specified. * @return the granularity of the index */ public long getGranularity() { return header.getGranularity(); }
/** * Returns the granularity of the index, that is the number of alignments between subsequent entries in the index, * or zero if not specified. * @return the granularity of the index */ public long getGranularity() { return header.getGranularity(); }