public final class UploadFile
extends java.lang.Object
implements java.io.Closeable
| Constructor and Description |
|---|
UploadFile(java.lang.String fileName,
java.io.InputStream inputStream) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static UploadFile |
fromFile(java.io.File file)
Creates an UploadFile from the specified file.
|
static UploadFile |
fromFile(java.lang.String filePath)
Creates an UploadFile from the specified file.
|
static UploadFile |
fromResource(java.lang.String name)
Creates an UploadFile from the specified resource.
|
java.lang.String |
getFileName()
Getter for property
fileName. |
java.io.InputStream |
getInputStream()
Getter for property
inputStream. |
public UploadFile(java.lang.String fileName,
java.io.InputStream inputStream)
public static UploadFile fromFile(java.io.File file) throws java.io.FileNotFoundException
file - the file to uploadjava.io.FileNotFoundException - if the file does not exist,
is a directory rather than a regular file,
or for some other reason cannot be opened for
readingpublic static UploadFile fromFile(java.lang.String filePath) throws java.io.FileNotFoundException
filePath - the path of the file to uploadjava.io.FileNotFoundException - if the file does not exist,
is a directory rather than a regular file,
or for some other reason cannot be opened for
readingpublic static UploadFile fromResource(java.lang.String name) throws java.io.FileNotFoundException
name - the resource namejava.io.FileNotFoundException - if the resource could not be foundpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic java.lang.String getFileName()
fileName.fileNamepublic java.io.InputStream getInputStream()
inputStream.inputStream