|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.melati.servlet.BaseFileDataAdaptor
public abstract class BaseFileDataAdaptor
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 java.io.File |
file
The file in which to save the data. |
protected java.lang.String |
url
A URL to the data. |
| Constructor Summary | |
|---|---|
BaseFileDataAdaptor()
|
|
| Method Summary | |
|---|---|
protected abstract java.io.File |
calculateLocalFile()
|
protected abstract java.lang.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. |
java.io.File |
getFile()
Return a File object pointing to the saved data. |
long |
getSize()
Return the size of the data. |
java.lang.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 java.io.File file
protected java.lang.String url
public MultipartFormField field
| Constructor Detail |
|---|
public BaseFileDataAdaptor()
| Method Detail |
|---|
protected abstract java.io.File calculateLocalFile()
protected abstract java.lang.String calculateURL()
public byte[] getData()
getData in interface FormDataAdaptorpublic long getSize()
getSize in interface FormDataAdaptorlongpublic java.io.File getFile()
getFile in interface FormDataAdaptorfilepublic java.lang.String getURL()
FormDataAdaptor
getURL in interface FormDataAdaptor
public void readData(MultipartFormField fieldP,
DelimitedBufferedInputStream in,
byte[] delim)
throws java.io.IOException
readData in interface FormDataAdaptorfieldP - a MultipartFormFieldin - a DelimitedBufferedInputStreamdelim - the delimiter used to denote elements
java.io.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 | |||||||||