code: protected void writeBody(HttpURLConnection connection, ProgressListener listener) {
          if (this.body == null) {
              return;
          }
  
          connection.setDoOutput(true);
          try {
              OutputStream output = connection.getOutputStream();
              if (listener != null) {
                  output = new ProgressOutputStream(output, listener, this.bodyLength);
              }
              int b = this.body.read();
              while (b != -1) {
                  output.write(b);
                  b = this.body.read();
              }
              output.close();
          } catch (IOException e) {
              throw new BoxAPIException("Couldn't connect to the Box API due to a network error.", e);
          }
      }
docs: Writes the body of this request to an HttpURLConnection.
  
  <p>Subclasses overriding this method must remember to close the connection's OutputStream after writing.</p>
  
  @param connection the connection to which the body should be written.
  @param listener   an optional listener for monitoring the write progress.
  @throws BoxAPIException if an error occurs while writing to the connection.