/** {@inheritDoc} */ @Override public void writeLong(long v) throws IOException { NB.encodeInt64(buf, 0, v); fd.write(buf, 0, 8); }
private void encodeHeader(byte[] hdr) { System.arraycopy(FILE_HEADER_MAGIC, 0, hdr, 0, 4); int bs = alignBlocks ? refBlockSize : 0; NB.encodeInt32(hdr, 4, (VERSION_1 << 24) | bs); NB.encodeInt64(hdr, 8, minUpdateIndex); NB.encodeInt64(hdr, 16, maxUpdateIndex); }
static byte[] key(String ref, long index) { byte[] name = ref.getBytes(UTF_8); byte[] key = Arrays.copyOf(name, name.length + 1 + 8); NB.encodeInt64(key, key.length - 8, reverseUpdateIndex(index)); return key; }
private void writeFileFooter() { int ftrLen = FILE_FOOTER_LEN; byte[] ftr = new byte[ftrLen]; encodeHeader(ftr); NB.encodeInt64(ftr, 24, indexPosition(refs)); NB.encodeInt64(ftr, 32, (firstBlockPosition(objs) << 5) | objIdLen); NB.encodeInt64(ftr, 40, indexPosition(objs)); NB.encodeInt64(ftr, 48, firstBlockPosition(logs)); NB.encodeInt64(ftr, 56, indexPosition(logs)); CRC32 crc = new CRC32(); crc.update(ftr, 0, ftrLen - 4); NB.encodeInt32(ftr, ftrLen - 4, (int) crc.getValue()); out.write(ftr, 0, ftrLen); }
private void writeOffset64() throws IOException { for (PackedObjectInfo oe : entries) { final long o = oe.getOffset(); if (MAX_OFFSET_32 < o) { NB.encodeInt64(tmp, 0, o); out.write(tmp, 0, 8); } } } }
/** * Copy this LongObjectId to a byte array. * * @param b * the buffer to copy to. * @param o * the offset within b to write at. */ public void copyRawTo(byte[] b, int o) { NB.encodeInt64(b, o, w1); NB.encodeInt64(b, o + 8, w2); NB.encodeInt64(b, o + 16, w3); NB.encodeInt64(b, o + 24, w4); }
/** * Copy this LongObjectId to a byte array. * * @param b * the buffer to copy to. * @param o * the offset within b to write at. */ public void copyRawTo(final byte[] b, final int o) { NB.encodeInt64(b, o, w1); NB.encodeInt64(b, o + 8, w2); NB.encodeInt64(b, o + 16, w3); NB.encodeInt64(b, o + 24, w4); }
/** {@inheritDoc} */ @Override public void writeLong(long v) throws IOException { NB.encodeInt64(buf, 0, v); fd.write(buf, 0, 8); }
public void writeLong(long v) throws IOException { NB.encodeInt64(buf, 0, v); fd.write(buf, 0, 8); }
private void encodeHeader(byte[] hdr) { System.arraycopy(FILE_HEADER_MAGIC, 0, hdr, 0, 4); int bs = alignBlocks ? refBlockSize : 0; NB.encodeInt32(hdr, 4, (VERSION_1 << 24) | bs); NB.encodeInt64(hdr, 8, minUpdateIndex); NB.encodeInt64(hdr, 16, maxUpdateIndex); }
static byte[] key(String ref, long index) { byte[] name = ref.getBytes(UTF_8); byte[] key = Arrays.copyOf(name, name.length + 1 + 8); NB.encodeInt64(key, key.length - 8, reverseUpdateIndex(index)); return key; }
private void writeFileFooter() { int ftrLen = FILE_FOOTER_LEN; byte[] ftr = new byte[ftrLen]; encodeHeader(ftr); NB.encodeInt64(ftr, 24, indexPosition(refs)); NB.encodeInt64(ftr, 32, (firstBlockPosition(objs) << 5) | objIdLen); NB.encodeInt64(ftr, 40, indexPosition(objs)); NB.encodeInt64(ftr, 48, firstBlockPosition(logs)); NB.encodeInt64(ftr, 56, indexPosition(logs)); CRC32 crc = new CRC32(); crc.update(ftr, 0, ftrLen - 4); NB.encodeInt32(ftr, ftrLen - 4, (int) crc.getValue()); out.write(ftr, 0, ftrLen); }
private void writeOffset64() throws IOException { for (PackedObjectInfo oe : entries) { final long o = oe.getOffset(); if (MAX_OFFSET_32 < o) { NB.encodeInt64(tmp, 0, o); out.write(tmp, 0, 8); } } } }
private void writeOffset64() throws IOException { for (final PackedObjectInfo oe : entries) { final long o = oe.getOffset(); if (MAX_OFFSET_32 < o) { NB.encodeInt64(tmp, 0, o); out.write(tmp, 0, 8); } } } }