org.melati.servlet
Interface FormDataAdaptor

Package class diagram package FormDataAdaptor
All Known Implementing Classes:
BaseFileFormDataAdaptor, DefaultFileFormDataAdaptor, MemoryFormDataAdaptor, TemporaryFileFormDataAdaptor

public interface FormDataAdaptor

An interface to the data portion of a MultipartFormField.

This data is read in by readData and stored somewhere for later access by the other functions.

A class implementing FormDataAdaptor needs to implement at least the getData() and getSize() functions but need not provide a URL or a File for its data.


Method Summary
 byte[] getData()
          Return the data as a byte array.
 File getFile()
          Return a File object pointing to the saved data or null if none exists.
 long getSize()
          Return the size of the data.
 String getURL()
          Return a url to the object or null if none exists.
 void readData(MultipartFormField field, DelimitedBufferedInputStream in, byte[] delim)
          Read data from in until the delim is found and save the data so that we can access it again.
 

Method Detail

getData

byte[] getData()
Return the data as a byte array.

Returns:
the byte[]

getSize

long getSize()
Return the size of the data.

Returns:
the size as a long

getFile

File getFile()
Return a File object pointing to the saved data or null if none exists.

Returns:
the File

getURL

String getURL()
Return a url to the object or null if none exists.

Returns:
the url as a String or null

readData

void readData(MultipartFormField field,
              DelimitedBufferedInputStream in,
              byte[] delim)
              throws IOException
Read data from in until the delim is found and save the data so that we can access it again.

Parameters:
field - a MultipartFormField to be read
in - a DelimitedBufferedInputStream to read from
delim - the delimitor to differentiate elements
Throws:
IOException - if there is a problem reading the input


Copyright © 2000-2010 PanEris. All Rights Reserved.