|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FileData
This class contains all data and methods for a file to upload. The current
UploadPolicy contains the necessary parameters
to personalize the way files must be handled.
The JUpload package provides a default implementation of this class in
DefaultFileData. This default implementation contains all necessary
methods to allow upload. You can override it to add new file behaviour. For
instance, you could add a XMLFileData, that would check that XML is valid
before upload. See the package summary
for more details about that.
This class is the interface that all FileData must implement. The
DefaultFileData class contains the default implementation for this
interface. The PictureFileData contains another implementation of
this interface, adapted to manage pictures (rotation, resizing...).
The instance of FileData is created by the
UploadPolicy.createFileData(File, File) method. This method can be
overrided in a new upoad policy, to create an instance of another FileData.
See PictureFileData for an example about FileData customization.
| Method Summary | |
|---|---|
void |
afterUpload()
This function is called after upload, whether it is successful or not. |
void |
appendFileProperties(wjhk.jupload2.upload.helper.ByteArrayEncoder bae)
Called during the upload, by the FileUploadThread. |
void |
beforeUpload()
Prepare the fileData to upload. |
boolean |
canRead()
Indicate if this file can be read. |
String |
getDirectory()
Get the directory of the file. |
File |
getFile()
Standard getter, for the file described by the FileData instance. |
String |
getFileExtension()
|
long |
getFileLength()
|
String |
getFileName()
Get the original filename. |
InputStream |
getInputStream()
This function creates an InputStream from this file. |
Date |
getLastModified()
|
String |
getMimeType()
This function return the FileData content type. |
String |
getRelativeDir()
Retrieves the path of this file relative to it's root dir |
long |
getUploadLength()
Get size of upload, which may be different from th actual file length. |
| Method Detail |
|---|
void appendFileProperties(wjhk.jupload2.upload.helper.ByteArrayEncoder bae)
throws JUploadIOException
FileUploadThread. The FileData
instance should then call the
ByteArrayEncoder.appendFileProperty(String, String) method to add
each file property to the current upload.
bae - The byte encoder, where the properties must be added
JUploadIOException - Encapsulation of the IOException, if any would occurs.ByteArrayEncoder.appendFileProperty(String, String)
void beforeUpload()
throws JUploadException
PictureFileData. This method is called before
the upload of this file.
JUploadException - Encapsulation of the Exception, if any would occurs.FileUploadThread
long getUploadLength()
throws JUploadException
JUploadException - Encapsulation of the Exception, if any would occurs.PictureFileDatavoid afterUpload()
PictureFileData.afterUpload() removes the temporary
file, if any was created.
InputStream getInputStream()
throws JUploadException
FileUploadThread class then reads bytes from it and transfers
them to the webserver. The caller is responsible for closing this stream.
JUploadException - Encapsulation of the Exception, if any would occurs.String getFileName()
String getFileExtension()
long getFileLength()
Date getLastModified()
String getDirectory()
String getMimeType()
boolean canRead()
File getFile()
String getRelativeDir()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||