com.sun.rave.web.ui.model
Interface UploadedFile

All Superinterfaces:
java.io.Serializable

public interface UploadedFile
extends java.io.Serializable


Method Summary
 void dispose()
          Dispose of the resources associated with the file upload (this will happen automatically when the resource is garbage collected).
 java.lang.String getAsString()
          Use this method to retrieve the contents of the file as a String
 byte[] getBytes()
          Use this method to retrieve the contents of the file as an array of bytes.
 java.lang.String getContentType()
          Get the content-type that the browser communicated with the request that included the uploaded file.
 java.io.InputStream getInputStream()
          Returns a InputStream for reading the file.
 java.lang.String getOriginalName()
          Use this method to retrieve the name that the file has on the web application user's local system.
 long getSize()
          The size of the file in bytes
 void write(java.io.File file)
          Write the contents of the uploaded file to a file on the server host.
 

Method Detail

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns a InputStream for reading the file.

Returns:
An InputStream for reading the file.
Throws:
java.io.IOException - if there is a problem while reading the file

getContentType

java.lang.String getContentType()
Get the content-type that the browser communicated with the request that included the uploaded file. If the browser did not specify a content-type, this method returns null.

Returns:
the content-type that the browser communicated with the request that included the uploaded file

getOriginalName

java.lang.String getOriginalName()
Use this method to retrieve the name that the file has on the web application user's local system.

Returns:
the name of the file on the web app user's system

getSize

long getSize()
The size of the file in bytes

Returns:
The size of the file in bytes.

getBytes

byte[] getBytes()
Use this method to retrieve the contents of the file as an array of bytes.

Returns:
The contents of the file as a byte array

getAsString

java.lang.String getAsString()
Use this method to retrieve the contents of the file as a String

Returns:
the contents of the file as a String

write

void write(java.io.File file)
           throws java.lang.Exception
Write the contents of the uploaded file to a file on the server host. Note that writing files outside of the web server's tmp directory must be explicitly permitted through configuration of the server's security policy. This method is not guaranteed to succeed if called more than once for the same item.

Parameters:
file - The File where the contents should be written
Throws:
java.lang.Exception - the

dispose

void dispose()
Dispose of the resources associated with the file upload (this will happen automatically when the resource is garbage collected).