Package io.tus.java.client
Class TusUpload
- java.lang.Object
-
- io.tus.java.client.TusUpload
-
public class TusUpload extends java.lang.Object
This class contains information about a file which will be uploaded later. Uploading is not done using this class but usingTusUploader
whose instances are returned byTusClient.createUpload(TusUpload)
,TusClient.createUpload(TusUpload)
andTusClient.resumeOrCreateUpload(TusUpload)
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getEncodedMetadata()
Encode the metadata into a string according to the specification, so it can be used as the value for the Upload-Metadata header.java.lang.String
getFingerprint()
Returns the file specific fingerprint.java.io.InputStream
getInputStream()
Returns the input stream of the file to upload.java.util.Map<java.lang.String,java.lang.String>
getMetadata()
This method returns the upload's metadata as Map.long
getSize()
Returns the file size of the upload.void
setFingerprint(java.lang.String fingerprint)
Sets a fingerprint for this upload.void
setInputStream(java.io.InputStream inputStream)
Set the source from which will be read if the file will be later uploaded.void
setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
This methods allows it to send Metadata alongside with the upload.void
setSize(long size)
Set the file's size in bytes.
-
-
-
Constructor Detail
-
TusUpload
public TusUpload()
Create a new TusUpload object.
-
TusUpload
public TusUpload(@NotNull @NotNull java.io.File file) throws java.io.FileNotFoundException
Create a new TusUpload object using the supplied file object. The correspondingInputStream
, size and fingerprint will be automatically set.- Parameters:
file
- The file whose content should be later uploaded.- Throws:
java.io.FileNotFoundException
- Thrown if the file cannot be found.
-
-
Method Detail
-
getSize
public long getSize()
Returns the file size of the upload.- Returns:
- File size in bytes
-
setSize
public void setSize(long size)
Set the file's size in bytes.- Parameters:
size
- File's size in bytes.
-
getFingerprint
public java.lang.String getFingerprint()
Returns the file specific fingerprint.- Returns:
- Fingerprint as String.
-
setFingerprint
public void setFingerprint(java.lang.String fingerprint)
Sets a fingerprint for this upload. This fingerprint must be unique and file specific, because it is used for upload identification.- Parameters:
fingerprint
- String of fingerprint information.
-
getInputStream
public java.io.InputStream getInputStream()
Returns the input stream of the file to upload.- Returns:
InputStream
-
setInputStream
public void setInputStream(java.io.InputStream inputStream)
Set the source from which will be read if the file will be later uploaded.- Parameters:
inputStream
- The stream which will be read.
-
setMetadata
public void setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
This methods allows it to send Metadata alongside with the upload. The Metadata must be provided as a Map with Key - Value pairs of Type String.- Parameters:
metadata
- Key-value pairs of Type String
-
getMetadata
public java.util.Map<java.lang.String,java.lang.String> getMetadata()
This method returns the upload's metadata as Map.- Returns:
Map
of metadata Key - Value pairs.
-
getEncodedMetadata
public java.lang.String getEncodedMetadata()
Encode the metadata into a string according to the specification, so it can be used as the value for the Upload-Metadata header.- Returns:
- Encoded metadata
-
-