Source:
<code>void handleBody(InputStream payload, MessageMetadata messageMetadata, MessageInfo messageInfo) throws IOException, MessageFormatException { if (!successfullyDeserialized) { BlobData blobData; ByteBuffer encryptionKey; byte[] userMetadata = null; ByteBuffer rawPayloadBuffer = null; boolean rawMode = options.getBlobOptions.isRawMode(); if (rawMode) { <START> byte[] payloadBytes = new byte[payload.available()]; <END> payload.read(payloadBytes); payload = new ByteArrayInputStream(payloadBytes); rawPayloadBuffer = ByteBuffer.wrap(payloadBytes); } if (getOperationFlag() == MessageFormatFlags.Blob) { blobData = MessageFormatRecord.deserializeBlob(payload); encryptionKey = messageMetadata == null ? null : messageMetadata.getEncryptionKey(); } else { BlobAll blobAll = MessageFormatRecord.deserializeBlobAll(payload, blobIdFactory); BlobInfo serverBlobInfo = blobAll.getBlobInfo(); updateTtlIfRequired(serverBlobInfo.getBlobProperties(), messageInfo); getOptions().ageAtAccessTracker.trackAgeAtAccess(serverBlobInfo.getBlobProperties().getCreationTimeInMs()); blobData = blobAll.getBlobData(); encryptionKey = blobAll.getBlobEncryptionKey(); if (encryptionKey == null) { blobInfo = serverBlobInfo; } else { serverBlobProperties = serverBlobInfo.getBlobProperties(); userMetadata = serverBlobInfo.getUserMetadata(); } } blobType = blobData.getBlobType(); chunkIndexToBuffer = new TreeMap<>(); if (blobType == BlobType.MetadataBlob) { if (rawMode) { chunkIndexToBuffer.put(0, blobData.getStream().getByteBuffer()); numChunksRetrieved = 1; } else { handleMetadataBlob(blobData, userMetadata, encryptionKey); } } else { if (rawMode) { if (encryptionKey != null) { chunkIndexToBuffer.put(0, rawPayloadBuffer); numChunksRetrieved = 1; } else { setOperationException(new IllegalStateException("Only encrypted blobs supported in raw mode")); } } else { handleSimpleBlob(blobData, userMetadata, encryptionKey); } } successfullyDeserialized = true; } else { } }</code><technical_language>is a get size other stream ? (From PartitionResponseInfo for example)</technical_language>

Target:
void handleBody(InputStream payload, MessageMetadata messageMetadata, MessageInfo messageInfo) throws IOException, MessageFormatException { if (!successfullyDeserialized) { BlobData blobData; ByteBuffer encryptionKey; byte[] userMetadata = null; ByteBuffer rawPayloadBuffer = null; boolean rawMode = options.getBlobOptions.isRawMode(); if (rawMode) { if (messageInfo.getSize() > Integer.MAX_VALUE) { throw new IllegalStateException("Payload too large for blob " + blobId.getID()); } byte[] payloadBytes = new byte[(int) messageInfo.getSize()]; payload.read(payloadBytes); payload = new ByteArrayInputStream(payloadBytes); rawPayloadBuffer = ByteBuffer.wrap(payloadBytes); } if (getOperationFlag() == MessageFormatFlags.Blob) { blobData = MessageFormatRecord.deserializeBlob(payload); encryptionKey = messageMetadata == null ? null : messageMetadata.getEncryptionKey(); } else { BlobAll blobAll = MessageFormatRecord.deserializeBlobAll(payload, blobIdFactory); BlobInfo serverBlobInfo = blobAll.getBlobInfo(); updateTtlIfRequired(serverBlobInfo.getBlobProperties(), messageInfo); getOptions().ageAtAccessTracker.trackAgeAtAccess(serverBlobInfo.getBlobProperties().getCreationTimeInMs()); blobData = blobAll.getBlobData(); encryptionKey = blobAll.getBlobEncryptionKey(); if (encryptionKey == null) { blobInfo = serverBlobInfo; } else { serverBlobProperties = serverBlobInfo.getBlobProperties(); userMetadata = serverBlobInfo.getUserMetadata(); } } blobType = blobData.getBlobType(); chunkIndexToBuffer = new TreeMap<>(); if (rawMode) { if (encryptionKey != null) { chunkIdIterator = null; dataChunks = null; chunkIndex = 0; numChunksTotal = 1; chunkIndexToBuffer.put(0, rawPayloadBuffer); numChunksRetrieved = 1; } else { setOperationException(new IllegalStateException("Only encrypted blobs supported in raw mode")); } } else { if (blobType == BlobType.MetadataBlob) { handleMetadataBlob(blobData, userMetadata, encryptionKey); } else { handleSimpleBlob(blobData, userMetadata, encryptionKey); } } successfullyDeserialized = true; } else { } }