Source:
public PutMessageFormatInputStream(StoreKey key, BlobProperties blobProperties, ByteBuffer userMetadata, InputStream blobStream, long streamSize, BlobType blobType) throws MessageFormatException { int headerSize = MessageFormatRecord.MessageHeader_Format_V1.getHeaderSize(); int blobPropertiesRecordSize = MessageFormatRecord.BlobProperties_Format_V1.getBlobPropertiesRecordSize(blobProperties); int userMetadataSize = MessageFormatRecord.UserMetadata_Format_V1.getUserMetadataSize(userMetadata); long blobSize = MessageFormatRecord.Blob_Format_V2.getBlobRecordSize(streamSize); buffer = ByteBuffer.allocate(headerSize + key.sizeInBytes() + blobPropertiesRecordSize + userMetadataSize + (int) (blobSize - streamSize - MessageFormatRecord.Crc_Size)); MessageFormatRecord.MessageHeader_Format_V1 .serializeHeader(buffer, blobPropertiesRecordSize + userMetadataSize + blobSize, headerSize + key.sizeInBytes(), MessageFormatRecord.Message_Header_Invalid_Relative_Offset, headerSize + key.sizeInBytes() + blobPropertiesRecordSize, headerSize + key.sizeInBytes() + blobPropertiesRecordSize + userMetadataSize); buffer.put(key.toBytes()); MessageFormatRecord.BlobProperties_Format_V1.serializeBlobPropertiesRecord(buffer, blobProperties); MessageFormatRecord.UserMetadata_Format_V1.serializeUserMetadataRecord(buffer, userMetadata); int bufferBlobStart = buffer.position(); MessageFormatRecord.Blob_Format_V2.serializePartialBlobRecord(buffer, streamSize, blobType); Crc32 crc = new Crc32(); crc.update(buffer.array(), bufferBlobStart, buffer.position() - bufferBlobStart); stream = new CrcInputStream(crc, blobStream); streamLength = streamSize; messageLength = buffer.capacity() + streamLength + MessageFormatRecord.Crc_Size; buffer.flip(); }

Target:
public PutMessageFormatInputStream(StoreKey key, BlobProperties blobProperties, ByteBuffer userMetadata, InputStream blobStream, long streamSize, BlobType blobType) throws MessageFormatException { int headerSize = MessageFormatRecord.MessageHeader_Format_V1.getHeaderSize(); int blobPropertiesRecordSize = MessageFormatRecord.BlobProperties_Format_V1.getBlobPropertiesRecordSize(blobProperties); int userMetadataSize = MessageFormatRecord.UserMetadata_Format_V1.getUserMetadataSize(userMetadata); long blobSize = MessageFormatRecord.Blob_Format_V1.getBlobRecordSize(streamSize); buffer = ByteBuffer.allocate(headerSize + key.sizeInBytes() + blobPropertiesRecordSize + userMetadataSize + (int) (blobSize - streamSize - MessageFormatRecord.Crc_Size)); MessageFormatRecord.MessageHeader_Format_V1 .serializeHeader(buffer, blobPropertiesRecordSize + userMetadataSize + blobSize, headerSize + key.sizeInBytes(), MessageFormatRecord.Message_Header_Invalid_Relative_Offset, headerSize + key.sizeInBytes() + blobPropertiesRecordSize, headerSize + key.sizeInBytes() + blobPropertiesRecordSize + userMetadataSize); buffer.put(key.toBytes()); MessageFormatRecord.BlobProperties_Format_V1.serializeBlobPropertiesRecord(buffer, blobProperties); MessageFormatRecord.UserMetadata_Format_V1.serializeUserMetadataRecord(buffer, userMetadata); int bufferBlobStart = buffer.position(); MessageFormatRecord.Blob_Format_V1.serializePartialBlobRecord(buffer, streamSize); Crc32 crc = new Crc32(); crc.update(buffer.array(), bufferBlobStart, buffer.position() - bufferBlobStart); stream = new CrcInputStream(crc, blobStream); streamLength = streamSize; messageLength = buffer.capacity() + streamLength + MessageFormatRecord.Crc_Size; buffer.flip(); }