Source:
<code>public MessageInfo getMessageInfo(Read read, long offset, StoreKeyFactory storeKeyFactory) throws IOException { try { ByteBuffer headerVersion = ByteBuffer.allocate(MessageFormatRecord.Version_Field_Size_In_Bytes); read.readInto(headerVersion, offset); offset += headerVersion.capacity(); headerVersion.flip(); short version = headerVersion.getShort(); switch (version) { case MessageFormatRecord.Message_Header_Version_V1: ByteBuffer header = ByteBuffer.allocate(MessageFormatRecord.MessageHeader_Format_V1.getHeaderSize()); header.putShort(version); read.readInto(header, offset); offset += header.capacity() - headerVersion.capacity(); header.flip(); MessageFormatRecord.MessageHeader_Format_V1 headerFormat = new MessageFormatRecord.MessageHeader_Format_V1(header); headerFormat.verifyHeader(); long endOffset = headerFormat.getBlobPropertiesRecordRelativeOffset() != MessageFormatRecord.Message_Header_Invalid_Relative_Offset ? offset + headerFormat.getBlobPropertiesRecordRelativeOffset() + headerFormat.getMessageSize() : offset + headerFormat.getDeleteRecordRelativeOffset() + headerFormat.getMessageSize(); ReadInputStream stream = new ReadInputStream(read, offset, endOffset); StoreKey key = storeKeyFactory.getStoreKey(new DataInputStream(stream)); if (headerFormat.getBlobPropertiesRecordRelativeOffset() != MessageFormatRecord.Message_Header_Invalid_Relative_Offset) { BlobProperties properties = MessageFormatRecord.deserializeBlobProperties(stream); return new MessageInfo(key, header.capacity() + key.sizeInBytes() + headerFormat.getMessageSize(), Utils.addSecondsToEpochTime(properties.getCreationTimeInMs(), properties.getTimeToLiveInSeconds())); } else { DeleteRecord deleteRecord = MessageFormatRecord.deserializeDeleteRecord(stream); return new MessageInfo(key, header.capacity() + key.sizeInBytes() + headerFormat.getMessageSize(), true, deleteRecord.getAccountId(), deleteRecord.getContainerId(), deleteRecord.getDeletionTimeInMs()); } default: throw new MessageFormatException("Version not known while reading message - " + version, MessageFormatErrorCodes.Unknown_Format_Version); } } catch (MessageFormatException e) { <START> throw new IOException("Message format exception while parsing messages ", e); <END> } catch (IndexOutOfBoundsException e) { throw new IOException("Trying to read more than the available bytes"); } }</code><technical_language>need {}</technical_language>

Target:
public MessageInfo getMessageInfo(Read read, long offset, StoreKeyFactory storeKeyFactory) throws IOException { try { ByteBuffer headerVersion = ByteBuffer.allocate(MessageFormatRecord.Version_Field_Size_In_Bytes); read.readInto(headerVersion, offset); offset += headerVersion.capacity(); headerVersion.flip(); short version = headerVersion.getShort(); switch (version) { case MessageFormatRecord.Message_Header_Version_V1: ByteBuffer header = ByteBuffer.allocate(MessageFormatRecord.MessageHeader_Format_V1.getHeaderSize()); header.putShort(version); read.readInto(header, offset); offset += header.capacity() - headerVersion.capacity(); header.flip(); MessageFormatRecord.MessageHeader_Format_V1 headerFormat = new MessageFormatRecord.MessageHeader_Format_V1(header); headerFormat.verifyHeader(); long endOffset = headerFormat.getBlobPropertiesRecordRelativeOffset() != MessageFormatRecord.Message_Header_Invalid_Relative_Offset ? offset + headerFormat.getBlobPropertiesRecordRelativeOffset() + headerFormat.getMessageSize() : offset + headerFormat.getDeleteRecordRelativeOffset() + headerFormat.getMessageSize(); ReadInputStream stream = new ReadInputStream(read, offset, endOffset); StoreKey key = storeKeyFactory.getStoreKey(new DataInputStream(stream)); if (headerFormat.getBlobPropertiesRecordRelativeOffset() != MessageFormatRecord.Message_Header_Invalid_Relative_Offset) { BlobProperties properties = MessageFormatRecord.deserializeBlobProperties(stream); return new MessageInfo(key, header.capacity() + key.sizeInBytes() + headerFormat.getMessageSize(), Utils.addSecondsToEpochTime(properties.getCreationTimeInMs(), properties.getTimeToLiveInSeconds())); } else { DeleteRecord deleteRecord = MessageFormatRecord.deserializeDeleteRecord(stream); return new MessageInfo(key, header.capacity() + key.sizeInBytes() + headerFormat.getMessageSize(), true, deleteRecord.getAccountId(), deleteRecord.getContainerId(), deleteRecord.getDeletionTimeInMs()); } default: throw new MessageFormatException("Version not known while reading message - " + version, MessageFormatErrorCodes.Unknown_Format_Version); } } catch (MessageFormatException e) { throw new IOException("Message format exception while parsing messages ", e); } catch (IndexOutOfBoundsException e) { throw new IOException("Trying to read more than the available bytes"); } }