de.opus5.servlet
Class UploadedFile

java.lang.Object
  |
  +--de.opus5.servlet.UploadedFile
Direct Known Subclasses:
DiskFile, MemoryFile

public abstract class UploadedFile
extends java.lang.Object

Abstract base class for Uploaded files. Descendants must implement getInputStream() and getOutputStream(). You should set the filesize.

Version:
0.1.6
Author:
Frederik Dahlke, frederik.dahlke@web.de

Constructor Summary
UploadedFile(java.lang.String paraname, java.lang.String filename)
          Create a new UploadedFile
 
Method Summary
 java.lang.String getContentType()
          Retruns file's contentType
 java.io.File getFile()
          Classes extending UploadedFile can override this method and return the appropriate file object.
 java.lang.String getFormParameterName()
          returns the name of the file upload form field.
abstract  java.io.InputStream getInputStream()
          Returns an InputStream for reading the filedata.
 java.lang.String getName()
          Returns the file's name.
abstract  java.io.OutputStream getOutputStream()
          Returns an OutputStream for reading the filedata.
 int getSize()
          Returns the file's size.
 void setContentType(java.lang.String ct)
          set file's contentType
 void setSize(int size)
          set file's size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UploadedFile

public UploadedFile(java.lang.String paraname,
                    java.lang.String filename)
Create a new UploadedFile
Parameters:
paraname - the form field name
filename - the file's name
size - the file's size in bytes
Method Detail

getContentType

public java.lang.String getContentType()
Retruns file's contentType

getFile

public java.io.File getFile()
Classes extending UploadedFile can override this method and return the appropriate file object. By default this Method allways returns null.

getFormParameterName

public java.lang.String getFormParameterName()
returns the name of the file upload form field.
Returns:
form parameter name

getInputStream

public abstract java.io.InputStream getInputStream()
                                            throws java.io.IOException
Returns an InputStream for reading the filedata.
Returns:
an InputStream

getName

public java.lang.String getName()
Returns the file's name.
Returns:
the filename

getOutputStream

public abstract java.io.OutputStream getOutputStream()
                                              throws java.io.IOException
Returns an OutputStream for reading the filedata.
Returns:
an OutputStream

getSize

public int getSize()
Returns the file's size.
Returns:
the filesize in bytes

setContentType

public void setContentType(java.lang.String ct)
set file's contentType
Parameters:
contentType -  

setSize

public void setSize(int size)
set file's size
Parameters:
filesize -