in src/main/java/com/spotify/sparkey/CompressedWriter.java [66:83]
public void put(byte[] key, int keyLen, InputStream value, long valueLen) throws IOException {
int keySize = Util.unsignedVLQSize(keyLen + 1) + Util.unsignedVLQSize(valueLen);
long totalSize = keySize + keyLen + valueLen;
smartFlush(keySize, totalSize);
flushed = false;
currentNumEntries++;
Util.writeUnsignedVLQ(keyLen + 1, compressedOutputStream);
Util.writeUnsignedVLQ(valueLen, compressedOutputStream);
compressedOutputStream.write(key, 0, keyLen);
Util.copy(valueLen, value, compressedOutputStream, buf);
// Make sure that the beginning of each block is the start of a key/value pair
if (flushed && compressedOutputStream.getPending() > 0) {
compressedOutputStream.flush();
}
}