|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.melati.servlet.BaseFileFormDataAdaptor
public abstract class BaseFileFormDataAdaptor
Common elements of uploading a file from an HTML form. We store the data uploaded from a multipart form by saving it to a file on disk and, optionally, give it an associated URL.
Field Summary | |
---|---|
protected int |
BUFSIZE
Size for byte buffers. |
MultipartFormField |
field
Information about the uploaded file. |
protected File |
file
The file in which to save the data. |
protected String |
url
A URL to the data. |
Constructor Summary | |
---|---|
BaseFileFormDataAdaptor()
|
Method Summary | |
---|---|
protected abstract File |
calculateLocalFile()
|
protected abstract String |
calculateURL()
Return a URL to the saved file, null if not appropriate. |
byte[] |
getData()
Return the data in the file as a byte array. |
File |
getFile()
Return a File object pointing to the saved data. |
long |
getSize()
Return the size of the data. |
String |
getURL()
Return a url to the object or null if none exists. |
void |
readData(MultipartFormField fieldP,
DelimitedBufferedInputStream in,
byte[] delim)
Read data from in until the delim, work out which file to save it in, and save it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int BUFSIZE
protected File file
protected String url
public MultipartFormField field
Constructor Detail |
---|
public BaseFileFormDataAdaptor()
Method Detail |
---|
protected abstract File calculateLocalFile()
protected abstract String calculateURL()
public byte[] getData()
getData
in interface FormDataAdaptor
public long getSize()
getSize
in interface FormDataAdaptor
long
public File getFile()
getFile
in interface FormDataAdaptor
file
public String getURL()
FormDataAdaptor
getURL
in interface FormDataAdaptor
public void readData(MultipartFormField fieldP, DelimitedBufferedInputStream in, byte[] delim) throws IOException
readData
in interface FormDataAdaptor
fieldP
- a MultipartFormField
in
- a DelimitedBufferedInputStream
delim
- the delimiter used to denote elements
IOException
- if there is a problem reading the input
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |