001package com.box.sdk;
002
003import java.io.InputStream;
004import java.util.Date;
005
006/**
007 * Contains parameters for configuring an upload to Box.
008 */
009public class FileUploadParams {
010    private InputStream content;
011    private String name;
012    private Date created;
013    private Date modified;
014    private long size;
015    private ProgressListener listener;
016    private String sha1;
017
018    /**
019     * Constructs a new FileUploadParams with default parameters.
020     */
021    public FileUploadParams() { }
022
023    /**
024     * Gets the content that will be uploaded to Box.
025     * @return an InputStream that reads the content to be uploaded to Box.
026     */
027    public InputStream getContent() {
028        return this.content;
029    }
030
031    /**
032     * Sets the content that will be uploaded to Box.
033     * @param  content an InputStream that reads from the content to be uploaded to Box.
034     * @return         this FileUploadParams object for chaining.
035     */
036    public FileUploadParams setContent(InputStream content) {
037        this.content = content;
038        return this;
039    }
040
041    /**
042     * Gets the name that will be given to the uploaded file.
043     * @return the name that will be given to the uploaded file.
044     */
045    public String getName() {
046        return this.name;
047    }
048
049    /**
050     * Sets the name that will be given to the uploaded file.
051     * @param  name the name that will be given to the uploaded file.
052     * @return      this FileUploadParams object for chaining.
053     */
054    public FileUploadParams setName(String name) {
055        this.name = name;
056        return this;
057    }
058
059    /**
060     * Gets the content created date that will be given to the uploaded file.
061     * @return the content created date that will be given to the uploaded file.
062     */
063    public Date getCreated() {
064        return this.created;
065    }
066
067    /**
068     * Sets the content created date that will be given to the uploaded file.
069     * @param  created the content created date that will be given to the uploaded file.
070     * @return         this FileUploadParams object for chaining.
071     */
072    public FileUploadParams setCreated(Date created) {
073        this.created = created;
074        return this;
075    }
076
077    /**
078     * Gets the content modified date that will be given to the uploaded file.
079     * @return the content modified date that will be given to the uploaded file.
080     */
081    public Date getModified() {
082        return this.modified;
083    }
084
085    /**
086     * Sets the content modified date that will be given to the uploaded file.
087     * @param  modified the content modified date that will be given to the uploaded file.
088     * @return          this FileUploadParams object for chaining.
089     */
090    public FileUploadParams setModified(Date modified) {
091        this.modified = modified;
092        return this;
093    }
094
095    /**
096     * Gets the size of the file's content used for monitoring the upload's progress.
097     * @return the size of the file's content.
098     */
099    public long getSize() {
100        return this.size;
101    }
102
103    /**
104     * Sets the size of the file content used for monitoring the upload's progress.
105     * @param  size the size of the file's content.
106     * @return      this FileUploadParams object for chaining.
107     */
108    public FileUploadParams setSize(long size) {
109        this.size = size;
110        return this;
111    }
112
113    /**
114     * Gets the ProgressListener that will be used for monitoring the upload's progress.
115     * @return the ProgressListener that will be used for monitoring the upload's progress.
116     */
117    public ProgressListener getProgressListener() {
118        return this.listener;
119    }
120
121    /**
122     * Sets the ProgressListener that will be used for monitoring the upload's progress.
123     * @param  listener the listener that will be used for monitoring the upload's progress.
124     * @return          this FileUploadParams object for chaining.
125     */
126    public FileUploadParams setProgressListener(ProgressListener listener) {
127        this.listener = listener;
128        return this;
129    }
130
131    /**
132     * Set the SHA-1 hash of the file to ensure it is not corrupted during the upload.
133     * @param sha1 the SHA-1 hash of the file.
134     * @return     this FileUploadParams for chaining.
135     */
136    public FileUploadParams setSHA1(String sha1) {
137        this.sha1 = sha1;
138        return this;
139    }
140
141    /**
142     * Gets the file's SHA-1 hash.
143     * @return the file hash.
144     */
145    public String getSHA1() {
146        return this.sha1;
147    }
148}