Source:
public static BlobAll deserializeBlobAll(InputStream stream, StoreKeyFactory storeKeyFactory) throws IOException, MessageFormatException { boolean hasEncryptionKeyRecord = false; DataInputStream inputStream = new DataInputStream(stream); short headerVersion = inputStream.readShort(); ByteBuffer headerBuf; switch (headerVersion) { case Message_Header_Version_V1: headerBuf = ByteBuffer.allocate(MessageFormatRecord.MessageHeader_Format_V1.getHeaderSize()); headerBuf.putShort(headerVersion); inputStream.read(headerBuf.array(), Version_Field_Size_In_Bytes, MessageHeader_Format_V1.getHeaderSize() - Version_Field_Size_In_Bytes); headerBuf.rewind(); new MessageHeader_Format_V1(headerBuf).verifyHeader(); break; case Message_Header_Version_V2: headerBuf = ByteBuffer.allocate(MessageFormatRecord.MessageHeader_Format_V2.getHeaderSize()); headerBuf.putShort(headerVersion); inputStream.read(headerBuf.array(), Version_Field_Size_In_Bytes, MessageHeader_Format_V2.getHeaderSize() - Version_Field_Size_In_Bytes); headerBuf.rewind(); MessageHeader_Format_V2 header = new MessageHeader_Format_V2(headerBuf); header.verifyHeader(); hasEncryptionKeyRecord = header.getBlobEncryptionKeyRecordRelativeOffset() != Message_Header_Invalid_Relative_Offset; break; default: throw new MessageFormatException("Message header version not supported", MessageFormatErrorCodes.Unknown_Format_Version); } StoreKey storeKey = storeKeyFactory.getStoreKey(new DataInputStream(stream)); BlobProperties blobProperties = deserializeBlobProperties(stream); ByteBuffer blobEncryptionKey = null; if (hasEncryptionKeyRecord) { blobEncryptionKey = deserializeBlobEncryptionKey(stream); } byte[] userMetadata = deserializeUserMetadata(stream).array(); BlobData blobData = deserializeBlob(stream); return new BlobAll(storeKey, blobEncryptionKey, new BlobInfo(blobProperties, userMetadata), blobData); }

Target:
public static BlobAll deserializeBlobAll(InputStream stream, StoreKeyFactory storeKeyFactory) throws IOException, MessageFormatException { DataInputStream inputStream = new DataInputStream(stream); short headerVersion = inputStream.readShort(); ByteBuffer headerBuf; MessageHeader_Format header; switch (headerVersion) { case Message_Header_Version_V1: headerBuf = ByteBuffer.allocate(MessageFormatRecord.MessageHeader_Format_V1.getHeaderSize()); headerBuf.putShort(headerVersion); inputStream.read(headerBuf.array(), Version_Field_Size_In_Bytes, MessageHeader_Format_V1.getHeaderSize() - Version_Field_Size_In_Bytes); headerBuf.rewind(); header = new MessageHeader_Format_V1(headerBuf); break; case Message_Header_Version_V2: headerBuf = ByteBuffer.allocate(MessageFormatRecord.MessageHeader_Format_V2.getHeaderSize()); headerBuf.putShort(headerVersion); inputStream.read(headerBuf.array(), Version_Field_Size_In_Bytes, MessageHeader_Format_V2.getHeaderSize() - Version_Field_Size_In_Bytes); headerBuf.rewind(); header = new MessageHeader_Format_V2(headerBuf); break; default: throw new MessageFormatException("Message header version not supported", MessageFormatErrorCodes.Unknown_Format_Version); } header.verifyHeader(); StoreKey storeKey = storeKeyFactory.getStoreKey(new DataInputStream(stream)); ByteBuffer blobEncryptionKey = null; if (header.hasEncryptionKeyRecord()) { blobEncryptionKey = deserializeBlobEncryptionKey(stream); } BlobProperties blobProperties = deserializeBlobProperties(stream); byte[] userMetadata = deserializeUserMetadata(stream).array(); BlobData blobData = deserializeBlob(stream); return new BlobAll(storeKey, blobEncryptionKey, new BlobInfo(blobProperties, userMetadata), blobData); }