|
Oracle interMedia Java Classes for Servlets and JSP API Reference 10g Release 2 (10.2) Part No. B14300-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.ord.im.OrdHttpUploadFile
The OrdHttpUploadFile class facilitates the handling of uploaded files by providing an API that applications can call to load media data into Oracle Database. Form-based file uploading using HTML forms encodes form data and uploaded files in POST requests using the multipart/form-data format. The OrdHttpUploadFile class is used to represent an uploaded file that has been parsed by the OrdHttpUploadFormData
class.
The OrdHttpUploadFile class provides methods to obtain information about the uploaded file, to access the contents of the file directly, and to facilitate loading the contents into an interMedia object in a database.
Every input field of type file
in an HTML form will produce a parameter of type OrdHttpUploadFile, whether or not a user enters a valid file name into such a field. Depending on the requirements, applications can test the length of the file name, the length of the content, or both, to determine if a valid file name was entered by a user and if the file was successfully uploaded by the browser. For example, if a user does not enter a file name, the getOriginalFileName()
method will return the file name whose length is zero. However, if a user enters either an invalid file name or the name of an empty (zero-length) file, the getOriginalFileName method will return the file name whose length is not zero, and the getContentLength()
method will return the content length of the file as zero.
In order to run interMedia methods for servlets and JSP, you will need to import classes from the oracle.ord.im package into your Java file.
You may also need to import classes from the following Java packages:
java.sql. java.io. javax.servlet. javax.servlet.http. oracle.jdbc. oracle.sql.
Method Summary | |
int |
getContentLength() Returns the length of the uploaded media file. |
java.io.InputStream |
getInputStream() Returns an InputStream object that can be used to read uploaded data directly. |
java.lang.String |
getMimeType() Returns the MIME type of the media file, as determined by the browser when the file is uploaded. |
java.lang.String |
getOriginalFileName() Returns the original file name, as provided by the browser. |
java.lang.String |
getSimpleFileName() Returns the simple file name, (that is, the name of the file and the extension). |
java.io.File |
getTempFile() Exists as an internal method only. |
void |
loadAudio(oracle.ord.im.OrdAudio audio) Loads the uploaded file into an OrdAudio Java object and sets the properties based on the audio data. |
void |
loadAudio(oracle.ord.im.OrdAudio audio, byte[][] ctx, boolean setComments) Loads the uploaded file into an OrdAudio Java object and sets the properties using an application-supplied, format plug-in context. |
void |
loadBlob(oracle.sql.BLOB blob) Loads the uploaded media file into a BLOB. |
void |
loadDoc(oracle.ord.im.OrdDoc doc) Loads the uploaded file into an OrdDoc Java object and sets the properties based on the contents of the document. |
void |
loadDoc(oracle.ord.im.OrdDoc doc, byte[][] ctx, boolean setComments) Loads the uploaded file into an OrdDoc Java object and sets the properties using an application-supplied, format plug-in context. |
void |
loadImage(oracle.ord.im.OrdImage image) Loads the uploaded file into an OrdImage Java object and sets the properties based on the image data. |
void |
loadImage(oracle.ord.im.OrdImage image, java.lang.String cmd) Loads the uploaded file into an OrdImage Java object and sets the properties according to an application-supplied command string. |
void |
loadVideo(oracle.ord.im.OrdVideo video) Loads the uploaded file into an OrdVideo Java object and sets the properties based on the video data. |
void |
loadVideo(oracle.ord.im.OrdVideo video, byte[][] ctx, boolean setComments) Loads the uploaded file into an OrdVideo Java object and sets the properties using an application-supplied, format plug-in context. |
void |
release() Releases all resources held by an OrdHttpUploadFile object. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public java.lang.String getOriginalFileName()
String
.public java.lang.String getSimpleFileName()
String
.public java.lang.String getMimeType()
Some browsers return a default MIME type even if you do not supply a file name; therefore, the application should check the file name or content length to ensure the file was uploaded successfully.
String
.public int getContentLength()
public java.io.InputStream getInputStream() throws java.io.IOException
java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.java.io.IOException
- if an error occurs opening the temporary file.public void loadImage(oracle.ord.im.OrdImage image) throws java.sql.SQLException, java.io.IOException
If the call to the setProperties method fails because the image format is not recognized, this method sets the following properties:
image
- an object of type oracle.ord.im.OrdImage
into which the image data will be loaded.java.io.IOException
- if an error occurs reading or writing the media data.java.sql.SQLException
- if an unrecognized error occurs storing the media data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadImage(oracle.ord.im.OrdImage image, java.lang.String cmd) throws java.sql.SQLException, java.io.IOException
image
- an object of type oracle.ord.im.OrdImage
into which the image data will be loaded.cmd
- a String
that specifies the properties to be set.java.io.IOException
- if an error occurs reading or writing the media data.java.sql.SQLException
- if an unrecognized error occurs storing the media data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadAudio(oracle.ord.im.OrdAudio audio) throws java.sql.SQLException, java.io.IOException
If the call to the setProperties method fails because the audio format is not recognized, this method sets the following properties:
audio
- an object of type oracle.ord.im.OrdAudio
into which the audio data will be loaded.java.io.IOException
- if an error occurs reading or writing the media data.java.sql.SQLException
- if an unrecognized error occurs storing the media data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadAudio(oracle.ord.im.OrdAudio audio, byte[][] ctx, boolean setComments) throws java.sql.SQLException, java.io.IOException
If the call to the setProperties method fails because the audio format is not recognized, this method sets the following properties:
audio
- an object of type oracle.ord.im.OrdAudio
into which the audio data will be loaded.ctx
- the format plug-in context information.setComments
- a boolean
value indicating whether or not to set the comments in the OrdAudio object.java.io.IOException
- if an error occurs reading or writing the media data.java.sql.SQLException
- if an unrecognized error occurs storing the media data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadVideo(oracle.ord.im.OrdVideo video) throws java.sql.SQLException, java.io.IOException
If the call to the setProperties method fails because the video format is not recognized, this method sets the following properties:
video
- an object of type oracle.ord.im.OrdVideo
into which the video data will be loaded.java.io.IOException
- if an error occurs reading or writing the media data.java.sql.SQLException
- if an unrecognized error occurs storing the media data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadVideo(oracle.ord.im.OrdVideo video, byte[][] ctx, boolean setComments) throws java.sql.SQLException, java.io.IOException
If the call to the setProperties method fails because the video format is not recognized, this method sets the following properties:
video
- an object of type oracle.ord.im.OrdVideo
into which the video data will be loaded.ctx
- the format plug-in context information.setComments
- a boolean
value indicating whether or not to set the comments in the OrdVideo object.java.io.IOException
- if an error occurs reading or writing the media data.java.sql.SQLException
- if an unrecognized error occurs storing the media data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadDoc(oracle.ord.im.OrdDoc doc) throws java.sql.SQLException, java.io.IOException
If the call to the setProperties method fails because the document format is not recognized, this method sets the following properties:
doc
- an object of type oracle.ord.im.OrdDoc
into which the document will be loaded.java.io.IOException
- if an error occurs reading or writing the media data.java.sql.SQLException
- if an unrecognized error occurs storing the media data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadDoc(oracle.ord.im.OrdDoc doc, byte[][] ctx, boolean setComments) throws java.sql.SQLException, java.io.IOException
If the call to the setProperties method fails because the document format is not recognized, this method sets the following properties:
doc
- an object of type oracle.ord.im.OrdDoc
into which the document will be loaded.ctx
- the format plug-in context information.setComments
- a boolean
value indicating whether or not to set the comments in the OrdDoc object.java.io.IOException
- if an error occurs reading or writing the media data.java.sql.SQLException
- if an unrecognized error occurs storing the media data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadBlob(oracle.sql.BLOB blob) throws java.sql.SQLException, java.io.IOException
blob
- an object of type oracle.sql.BLOB
into which the data will be loaded.java.io.IOException
- if an error occurs reading or writing the media data.java.sql.SQLException
- if an unrecognized error occurs storing the media data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void release()
public java.io.File getTempFile()
|
Oracle interMedia Java Classes for Servlets and JSP API Reference 10g Release 2 (10.2) Part No. B14300-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |