com.scooterframework.web.controller
Class UploadFile

java.lang.Object
  extended by com.scooterframework.web.controller.UploadFile

public class UploadFile
extends java.lang.Object

UploadFile represents a file uploaded.


Constructor Summary
UploadFile(org.apache.commons.fileupload.FileItem fi)
           
 
Method Summary
 byte[] getContent()
          Returns the contents of the file item as an array of bytes.
 java.lang.String getContentType()
          Returns the content type passed by the browser or null if not defined.
 java.lang.String getFieldName()
          Returns the name of the field in the multipart form corresponding to this file item.
 java.lang.String getFieldValue()
          Returns the value of the field in the multipart form corresponding to this file item.
 java.lang.String getFileName()
          Returns the original file name.
 java.io.InputStream getInputStream()
          Returns an InputStream that can be used to retrieve the contents of the file.
 java.io.OutputStream getOutputStream()
          Returns an OutputStream that can be used for storing the contents of the file.
 long getSize()
          Returns the size of the file item.
 void writeTo(java.io.File file)
          Writes an uploaded item to disk.
 void writeTo(java.lang.String dirPath)
          Writes an uploaded item to disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UploadFile

public UploadFile(org.apache.commons.fileupload.FileItem fi)
Method Detail

getContentType

public java.lang.String getContentType()
Returns the content type passed by the browser or null if not defined.


getFieldName

public java.lang.String getFieldName()
Returns the name of the field in the multipart form corresponding to this file item.


getFieldValue

public java.lang.String getFieldValue()
Returns the value of the field in the multipart form corresponding to this file item.


getFileName

public java.lang.String getFileName()
Returns the original file name.


getContent

public byte[] getContent()
Returns the contents of the file item as an array of bytes.


getSize

public long getSize()
Returns the size of the file item.


writeTo

public void writeTo(java.lang.String dirPath)
             throws java.lang.Exception
Writes an uploaded item to disk.

Parameters:
dirPath - The directory into which the uploaded item should be stored.
Throws:
java.lang.Exception

writeTo

public void writeTo(java.io.File file)
             throws java.lang.Exception
Writes an uploaded item to disk.

Parameters:
file - The File into which the uploaded item should be stored.
Throws:
java.lang.Exception

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns an InputStream that can be used to retrieve the contents of the file.

Throws:
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Returns an OutputStream that can be used for storing the contents of the file.

Throws:
java.io.IOException