binaryOutput.writeLong(streamLength);
currentBinaryStreamLength = streamLength;
// Wrap our binaryOutput in a CountingOutputStream so that we can
// validate the length later
return currentBinaryStream = new CountingOutputStream(new UncloseableOutputStream(binaryOutput));
}