void writeVarint(long val) { int n = tmp.length; tmp[--n] = (byte) (val & 0x7f); while ((val >>>= 7) != 0) { tmp[--n] = (byte) (0x80 | (--val & 0x7F)); } write(tmp, n, tmp.length - n); }
void writeVarintString(byte[] msg) { writeVarint(msg.length); write(msg, 0, msg.length); }
void writeKey(ReftableOutputStream os) { int sfxLen = key.length - prefixLen; os.writeVarint(prefixLen); os.writeVarint(encodeSuffixAndType(sfxLen, valueType())); os.write(key, prefixLen, sfxLen); }
private void writeFileHeader() { byte[] hdr = new byte[FILE_HEADER_LEN]; encodeHeader(hdr); out.write(hdr, 0, FILE_HEADER_LEN); }
void writeVarintString(byte[] msg) { writeVarint(msg.length); write(msg, 0, msg.length); }
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); }
void writeKey(ReftableOutputStream os) { int sfxLen = key.length - prefixLen; os.writeVarint(prefixLen); os.writeVarint(encodeSuffixAndType(sfxLen, valueType())); os.write(key, prefixLen, sfxLen); }
void writeVarint(long val) { int n = tmp.length; tmp[--n] = (byte) (val & 0x7f); while ((val >>>= 7) != 0) { tmp[--n] = (byte) (0x80 | (--val & 0x7F)); } write(tmp, n, tmp.length - n); }
private void writeFileHeader() { byte[] hdr = new byte[FILE_HEADER_LEN]; encodeHeader(hdr); out.write(hdr, 0, FILE_HEADER_LEN); }
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); }