public class FileInformation extends ResolvableBean
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
logger |
Constructor and Description |
---|
FileInformation(File file)
Create an instance of fileinformation based on the given file.
|
FileInformation(org.apache.commons.fileupload.FileItem myFileItem,
FileUploadProvider fileUploadProvider)
Create a FileInformation object base of the given FileItem
|
FileInformation(String fileName,
long fileSize,
String contentType,
byte[] fileData)
Create a FileInformation object with preset data
|
FileInformation(String fileName,
long fileSize,
String contentType,
byte[] fileData,
File file,
boolean deleteFileOnInvalidate)
Create an instance of fileinformation
|
Modifier and Type | Method and Description |
---|---|
FileInformation |
cloneFileInformation()
Can be used to retrieve a clone of a file item if it is needed longer
than one request long.
|
protected void |
finalize()
Called by the GC - invalidates this instance to delete tmp files.
|
String |
getContentType()
Returns the delivered ContentType of the File
|
String |
getFileName()
Returns the relative Path of the File.
|
String |
getFilePath()
Returns the upload Path if available or null if not.
|
long |
getFileSize()
Get the file size in bytes.
|
InputStream |
getInputStream()
Get an input stream for reading the content of an uploaded file
|
String |
getOriginalFileName()
Returns the "original" filename which was passed by the browser.
|
void |
invalidate()
Invalidates this instance of FileInformation.
|
canResolve, get, getProperty
public FileInformation(String fileName, long fileSize, String contentType, byte[] fileData)
fileName
- name of the filefileSize
- size of the filecontentType
- content typefileData
- file data as byte arraypublic FileInformation(org.apache.commons.fileupload.FileItem myFileItem, FileUploadProvider fileUploadProvider)
myFileItem
- file itemfileUploadProvider
- file upload providerpublic FileInformation(String fileName, long fileSize, String contentType, byte[] fileData, File file, boolean deleteFileOnInvalidate)
fileName
- filenamefileSize
- filesizecontentType
- contenttypefileData
- filedatafile
- filedeleteFileOnInvalidate
- true when the file will be deleted, false if notpublic FileInformation(File file)
invalidate()
.file
- fileprotected void finalize()
public final long getFileSize()
public final String getContentType()
public final String getOriginalFileName()
public final String getFileName()
public final String getFilePath()
public final InputStream getInputStream() throws IOException
IOException
- when fetching the input stream failspublic FileInformation cloneFileInformation()
public void invalidate()
Copyright © 2017 Gentics Software. All Rights Reserved.