code: private void appendEntity(OutputStream outputStream,
              ByteArrayInputStream byteArrayInputStream) {
          try {
              byte[] buffer = new byte[BUFFER_SIZE];
              while (true) {
                  int bytesRead = byteArrayInputStream.read(buffer);
                  if (bytesRead <= 0) {
                      break;
                  }
                  outputStream.write(buffer, 0, bytesRead);
              }
          } catch (IOException e) {
              throw new RuntimeException(e);
          }
      }
docs: Append entity.
  
  @param outputStream
  the output stream
  @param byteArrayInputStream
  the byte array input stream