public class FileInformation extends ResolvableBean
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
logger |
Constructor and Description |
---|
FileInformation(java.io.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(java.lang.String fileName,
long fileSize,
java.lang.String contentType,
byte[] fileData)
Create a FileInformation object with preset data
|
FileInformation(java.lang.String fileName,
long fileSize,
java.lang.String contentType,
byte[] fileData,
java.io.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.
|
java.lang.String |
getContentType()
Returns the delivered ContentType of the File
|
java.lang.String |
getFileName()
Returns the relative Path of the File.
|
java.lang.String |
getFilePath()
Returns the upload Path if available or null if not.
|
long |
getFileSize()
Get the file size in bytes.
|
java.io.InputStream |
getInputStream()
Get an input stream for reading the content of an uploaded file
|
java.lang.String |
getOriginalFileName()
Returns the "original" filename which was passed by the browser.
|
void |
invalidate()
Invalidates this instance of FileInformation.
|
canResolve, get, getProperty
public FileInformation(java.lang.String fileName, long fileSize, java.lang.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(java.lang.String fileName, long fileSize, java.lang.String contentType, byte[] fileData, java.io.File file, boolean deleteFileOnInvalidate)
fileName
- filenamefileSize
- filesizecontentType
- contenttypefileData
- filedatafile
- filedeleteFileOnInvalidate
- true when the file will be deleted, false if notpublic FileInformation(java.io.File file)
invalidate()
.file
- fileprotected void finalize()
finalize
in class java.lang.Object
public final long getFileSize()
public final java.lang.String getContentType()
public final java.lang.String getOriginalFileName()
public final java.lang.String getFileName()
public final java.lang.String getFilePath()
public final java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
- when fetching the input stream failspublic FileInformation cloneFileInformation()
public void invalidate()
Copyright © 2019 Gentics Software. All Rights Reserved.