1 | |
---|
2 | <HTML> |
---|
3 | |
---|
4 | <BODY> |
---|
5 | |
---|
6 | <P>This package allows you to change the file relative behaviour: this page describes how to override the |
---|
7 | default behaviour, to fullfill your needs (for instance add data compression, preload check, new data |
---|
8 | about files in the upload to the server..</P> |
---|
9 | |
---|
10 | |
---|
11 | <H3>What is FileData for ?</H3> |
---|
12 | |
---|
13 | The <a href="FileData.html">FileData</a> interface provides an easy way to add new file type capabilities to the applet. |
---|
14 | The main entry points allow you to: |
---|
15 | <DIR> |
---|
16 | <LI>Change the file behaviour for the upload. For instance: additional checks, compression before upload, new file properties |
---|
17 | to be sent to the server. |
---|
18 | <LI>New GUI capabilities: for instance an <a href="AudioFileData.html">AudioFileData</a> has been started, to allow the user to |
---|
19 | hear the sound in the files he selected. |
---|
20 | </DIR> |
---|
21 | |
---|
22 | <H3>HowTo create a new FileData instance</H3> |
---|
23 | |
---|
24 | The core/default implementation is contained in <a href="DefaultFileData.html">DefaultFileData</a>. This class provides a default |
---|
25 | implementation to all FileData interface methods. The easiest way to create a new FileData instance, is to inherit from this default |
---|
26 | implementation, and just override the method you're interested in. Doing this minimizes your work, and insures you the minimum risk |
---|
27 | of incompatibility with next versions.<BR> |
---|
28 | Once you've created your new XxxFileData class, you'll have to create objects of this class. This is done by creating a new |
---|
29 | {@link wjhk.jupload2.policies.UploadPolicy}, and override the |
---|
30 | {@link wjhk.jupload2.policies.UploadPolicy#createFileData(java.io.File, java.io.File)} method. |
---|
31 | |
---|
32 | <H3>Description of FileData methods</H3> |
---|
33 | |
---|
34 | <H4>Methods with impact on upload behaviour or content</H4> |
---|
35 | |
---|
36 | <TABLE> |
---|
37 | <TR> |
---|
38 | <TD>{@link wjhk.jupload2.filedata.FileData#appendFileProperties(ByteArrayEncoder, int)}</TD> |
---|
39 | <TD>Add properties like the filename, or the directory to the upload (useless in FTP mode)</TD> |
---|
40 | </TR> |
---|
41 | <TR> |
---|
42 | <TD>{@link wjhk.jupload2.filedata.FileData#beforeUpload()} </TD> |
---|
43 | <TD>Allows the FileData to do any necessary work before the upload of the file begin. For instance, in |
---|
44 | PictureFileData, the picture can here be resized, according to the upload policies values.</TD> |
---|
45 | </TR> |
---|
46 | <TR> |
---|
47 | <TD>{@link wjhk.jupload2.filedata.FileData#getUploadLength()} </TD> |
---|
48 | <TD>Returns the actual number of bytes that will be uploaded. Will be different from the file length, if the |
---|
49 | file must transformed before upload. For instance: picture resizing, or before upload compression.</TD> |
---|
50 | </TR> |
---|
51 | <TR> |
---|
52 | <TD>{@link wjhk.jupload2.filedata.FileData#afterUpload()}</TD> |
---|
53 | <TD>Called after the end of the upload. Allows to clear any resource, like temporary files.</TD> |
---|
54 | </TR> |
---|
55 | <TR> |
---|
56 | <TD>{@link wjhk.jupload2.filedata.FileData#getInputStream()}</TD> |
---|
57 | <TD>Returns an InputStream, that'll contain all bytes to upload.</TD> |
---|
58 | </TR> |
---|
59 | </TABLE> |
---|
60 | |
---|
61 | <H4>Methods for general file information</H4> |
---|
62 | |
---|
63 | You probably won't have to override these methods. |
---|
64 | |
---|
65 | <DIR> |
---|
66 | <LI>{@link wjhk.jupload2.filedata.FileData#getFileExtension()} |
---|
67 | <LI>{@link wjhk.jupload2.filedata.FileData#getFileLength()} |
---|
68 | <LI>{@link wjhk.jupload2.filedata.FileData#getLastModified()} |
---|
69 | <LI>{@link wjhk.jupload2.filedata.FileData#getDirectory()} |
---|
70 | <LI>{@link wjhk.jupload2.filedata.FileData#getMimeType()} |
---|
71 | <LI>{@link wjhk.jupload2.filedata.FileData#canRead()} |
---|
72 | <LI>{@link wjhk.jupload2.filedata.FileData#getFile()} |
---|
73 | <LI>{@link wjhk.jupload2.filedata.FileData#getRelativeDir()}: Returns the directory, relative to the current selection. Especially useful when |
---|
74 | dropping entire directories on the applet. |
---|
75 | </DIR> |
---|
76 | |
---|
77 | </BODY> |
---|
78 | </HTML> |
---|
79 | |
---|