@Override
  public void prepareBuffer(){
    super.prepareBuffer();
    bufferToSend.writeBytes(partitionId.getBytes());
    Utils.serializeString(bufferToSend, fileName, Charset.defaultCharset());
    bufferToSend.writeLong(startOffset);
    bufferToSend.writeLong(chunkSizeInBytes);
    bufferToSend.writeBoolean(isLastChunk);
    try {
      bufferToSend.writeBytes(chunkStream, chunkStream.available());
    } catch (IOException e) {
      logger.info("Error while writing chunkStream", e);
      throw new RuntimeException(e);
    }
  }
Write the response to the buffer.
ambry-protocol/src/main/java/com/github/ambry/protocol/FileCopyGetChunkResponse.java