code: public BoxFileUploadSessionPart uploadPart(InputStream stream, long offset, int partSize,
                                                 long totalSizeOfFile) {
  
          URL uploadPartURL = this.sessionInfo.getSessionEndpoints().getUploadPartEndpoint();
  
          BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), uploadPartURL, HttpMethod.PUT);
          request.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_OCTET_STREAM);
  
          //Read the partSize bytes from the stream
          byte[] bytes = new byte[partSize];
          try {
              stream.read(bytes);
          } catch (IOException ioe) {
              throw new BoxAPIException("Reading data from stream failed.", ioe);
          }
  
          return this.uploadPart(bytes, offset, partSize, totalSizeOfFile);
      }
docs: Uploads chunk of a stream to an open upload session.
  @param stream the stream that is used to read the chunck using the offset and part size.
  @param offset the byte position where the chunk begins in the file.
  @param partSize the part size returned as part of the upload session instance creation.
  Only the last chunk can have a lesser value.
  @param totalSizeOfFile The total size of the file being uploaded.
  @return the part instance that contains the part id, offset and part size.