public final class LargeFileUpload extends Object
Constructor and Description |
---|
LargeFileUpload()
Creates a LargeFileUpload object with a default number of parallel conections and timeout.
|
LargeFileUpload(int nParallelConnections,
long timeOut,
TimeUnit unit)
Creates a LargeFileUpload object.
|
Modifier and Type | Method and Description |
---|---|
String |
generateDigest(InputStream stream)
Generates the Base64 encoded SHA-1 hash for content available in the stream.
|
BoxFile.Info |
upload(BoxAPIConnection boxApi,
InputStream stream,
URL url,
long fileSize)
Creates a new version of a large file.
|
BoxFile.Info |
upload(BoxAPIConnection boxApi,
InputStream stream,
URL url,
long fileSize,
Map<String,String> fileAttributes)
Creates a new version of a large file and sets file attributes.
|
BoxFile.Info |
upload(BoxAPIConnection boxApi,
String folderId,
InputStream stream,
URL url,
String fileName,
long fileSize)
Uploads a new large file.
|
BoxFile.Info |
upload(BoxAPIConnection boxApi,
String folderId,
InputStream stream,
URL url,
String fileName,
long fileSize,
Map<String,String> fileAttributes)
Uploads a new large file and sets file attributes.
|
public LargeFileUpload(int nParallelConnections, long timeOut, TimeUnit unit)
nParallelConnections
- number of parallel http connections to usetimeOut
- time to wait before killing the jobunit
- time unit for the time wait valuepublic LargeFileUpload()
public BoxFile.Info upload(BoxAPIConnection boxApi, String folderId, InputStream stream, URL url, String fileName, long fileSize) throws InterruptedException, IOException
boxApi
- the API connection to be used by the upload session.folderId
- the id of the folder in which the file will be uploaded.stream
- the input stream that feeds the content of the file.url
- the upload session URL.fileName
- the name of the file to be created.fileSize
- the total size of the file.InterruptedException
- when a thread gets interupted.IOException
- when reading a stream throws exception.public BoxFile.Info upload(BoxAPIConnection boxApi, String folderId, InputStream stream, URL url, String fileName, long fileSize, Map<String,String> fileAttributes) throws InterruptedException, IOException
boxApi
- the API connection to be used by the upload session.folderId
- the id of the folder in which the file will be uploaded.stream
- the input stream that feeds the content of the file.url
- the upload session URL.fileName
- the name of the file to be created.fileSize
- the total size of the file.fileAttributes
- file attributes to setInterruptedException
- when a thread gets interupted.IOException
- when reading a stream throws exception.public BoxFile.Info upload(BoxAPIConnection boxApi, InputStream stream, URL url, long fileSize) throws InterruptedException, IOException
boxApi
- the API connection to be used by the upload session.stream
- the input stream that feeds the content of the file.url
- the upload session URL.fileSize
- the total size of the file.InterruptedException
- when a thread gets interupted.IOException
- when reading a stream throws exception.public BoxFile.Info upload(BoxAPIConnection boxApi, InputStream stream, URL url, long fileSize, Map<String,String> fileAttributes) throws InterruptedException, IOException
boxApi
- the API connection to be used by the upload session.stream
- the input stream that feeds the content of the file.url
- the upload session URL.fileSize
- the total size of the file.fileAttributes
- file attributes to set.InterruptedException
- when a thread gets interupted.IOException
- when reading a stream throws exception.public String generateDigest(InputStream stream)
stream
- the input stream of the file or data.