com.sun.webui.jsf.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 getClientFilePath()
          Return the literal value of the upload input element, else null.
 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 value that was submitted as the value of the upload input element.
 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 value that was submitted as the value of the upload input element. Some browsers only submit the file portion of the path and not the directory portion. This method returns the value submitted by the browser for the upload element's form-data value.

Returns:
the upload input element's form-data value.

getClientFilePath

java.lang.String getClientFilePath()
Return the literal value of the upload input element, else null. Some browsers only submit the file portion of the path and not the directory portion. This method returns the literal value of the upload input element.

Returns:
the upload input element's literal value
See Also:
Upload.isPreservePath()

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).



Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.