com.acciente.commons.htmlform
Class FileHandle

java.lang.Object
  extended by com.acciente.commons.htmlform.FileHandle

public class FileHandle
extends Object

This class is a facade to isolate the fileupload implementation from the multi-part parser used.

Author:
Adinath Raveendra Raj

Constructor Summary
FileHandle(org.apache.commons.fileupload.FileItem oFileItem)
           
 
Method Summary
 String getContentType()
          Returns the content type set by the browser that uploded the file, if not content type was set null is returned
 InputStream getInputStream()
          Returns an input stream that may used to read the contents of the uploaded file
 String getOriginFilename()
          Returns the original name of the uploaded file on the system from which it originated
 long getSize()
          Returns the size of the file in bytes
 void write(File oToFile)
          Write out the contents of the uploaded file to the specified destination
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileHandle

public FileHandle(org.apache.commons.fileupload.FileItem oFileItem)
Method Detail

getContentType

public String getContentType()
Returns the content type set by the browser that uploded the file, if not content type was set null is returned

Returns:
the mime type of the content

getSize

public long getSize()
Returns the size of the file in bytes

Returns:
the size of the file in bytes

getOriginFilename

public String getOriginFilename()
Returns the original name of the uploaded file on the system from which it originated

Returns:
a string filename including possibly a path

write

public void write(File oToFile)
           throws Exception
Write out the contents of the uploaded file to the specified destination

Parameters:
oToFile - the file to write to
Throws:
Exception - if an error occurs

getInputStream

public InputStream getInputStream()
                           throws IOException
Returns an input stream that may used to read the contents of the uploaded file

Returns:
an inputstream that provides access to the uploaded file
Throws:
IOException - if an error occurs


Copyright © 2008-2013 Acciente, LLC. All Rights Reserved.