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 ) ; }
Uploads chunk of a stream to an open upload session .