Skip Headers

Oracle® interMedia Java Classes Reference
10g Release 1 (10.1)

Part Number B10830-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

OrdHttpUploadFile Class

This section presents reference information on the methods of the oracle.ord.im.OrdHttpUploadFile class.

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 (see OrdHttpUploadFormData Class for more information on 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 length of the file name as 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 length of the file name, which will not be zero, and the getContentLength( ) method will return the content length of the file as zero.


getContentLength( )

Format

public int getContentLength( )

Description

Returns the length of the uploaded media file. If you enter an invalid file name, the name of a nonexistent file, or the name of an empty file, the length returned is zero.

Parameters

None.

Return Value

This method returns the length of the uploaded file.

Exceptions

None.

Examples

None.


getInputStream( )

Format

public java.io.InputStream getInputStream( )

Description

Returns an InputStream object that can be used to read uploaded data directly. Applications should close the stream with the close( ) method when finished.

Parameters

None.

Return Value

This method returns an InputStream object, from which to read the contents.

Exceptions

java.lang.IllegalStateException

This exception is thrown if the uploaded file is no longer available (for example: because it has been released).

java.io.IOException

This exception is thrown if an error occurs opening the temporary file.

Examples

None.


getMimeType( )

Format

public String getMimeType( )

Description

Returns the MIME type of the media file, as determined by the browser when the file is uploaded.

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.

Parameters

None.

Return Value

This method returns the MIME type of the file, as a String.

Exceptions

None.

Examples

None.


getOriginalFileName( )

Format

public String getOriginalFileName( )

Description

Returns the original file name, as provided by the browser. If you do not supply a file name, an empty String is returned.

Parameters

None.

Return Value

This method returns the file name, as a String.

Exceptions

None.

Examples

None.


getSimpleFileName( )

Format

public String getSimpleFileName( )

Description

Returns the simple file name (that is, the name of the file and the extension). If you do not supply a file name, an empty String is returned.

Parameters

None.

Return Value

This method returns the simple file name, as a String.

Exceptions

None.

Examples

None.


loadAudio(OrdAudio)

Format

public void loadAudio(oracle.ord.im.OrdAudio media)

Description

Loads the uploaded file into an OrdAudio Java object and sets the properties based on the audio data. This method loads the audio data into the database and calls the OrdAudio setProperties( ) method to set the properties, such as the MIME type. This method does not use any existing format plug-in context information and does not set any comments when setting the properties. To use this method, the application fetches an initialized OrdAudio object from the database, calls this method to load the audio data into the database, and then updates the OrdAudio object in the database.

If the call to the setProperties( ) method fails because the audio format is not recognized, this method sets the following properties:

Parameters

media

An object of type oracle.ord.im.OrdAudio into which the audio data will be loaded.

Return Value

None.

Exceptions

java.io.IOException

This exception is thrown if an error occurs while reading or writing the media data.

java.sql.SQLException

This exception is thrown if an unrecognized error occurs while storing the media data.

java.lang.IllegalStateException

This exception is thrown if the uploaded file is no longer available (for example: because it has been released).

Examples

None.


loadAudio(OrdAudio, byte[ ][ ], boolean)

Format

public void loadAudio(oracle.ord.im.OrdAudio media, byte[ ][ ] ctx, boolean setComments)

Description

Loads the uploaded file into an OrdAudio Java object and sets the properties using an application-supplied, format plug-in context. This method loads the audio data into the database and calls the OrdAudio setProperties( ) method to set the properties, such as the MIME type. The application provides the format plug-in context information and chooses whether or not to set the comments in the OrdAudio object. To use this method, the application fetches an initialized OrdAudio object from the database, calls this method to load the audio data into the database, and then updates the OrdAudio object in the database.

If the call to the setProperties( ) method fails because the audio format is not recognized, this method sets the following properties:

Parameters

media

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.

Return Value

None.

Exceptions

java.io.IOException

This exception is thrown if an error occurs while reading or writing the media data.

java.sql.SQLException

This exception is thrown if an unrecognized error occurs while storing the media data.

java.lang.IllegalStateException

This exception is thrown if the uploaded file is no longer available (for example: because it has been released).

Examples

None.


loadBlob(BLOB)

Format

public void loadBlob(oracle.sql.BLOB blob)

Description

Loads the uploaded media file into a BLOB.

Parameters

blob

An object of type oracle.sql.BLOB into which the data will be loaded.

Return Value

None.

Exceptions

java.io.IOException

This exception is thrown if an error occurs while reading or writing the media data.

java.sql.SQLException

This exception is thrown if an unrecognized error occurs while storing the media data.

java.lang.IllegalStateException

This exception is thrown if the uploaded file is no longer available (for example: because it has been released).

Examples

None.


loadDoc(OrdDoc)

Format

public void loadDoc(oracle.ord.im.OrdDoc media)

Description

Loads the uploaded file into an OrdDoc Java object and sets the properties based on the contents of the document. This method loads the document into the database and calls the OrdDoc setProperties( ) method to set the properties, such as the MIME type. This method does not use any existing format plug-in context information and does not set any comments when setting the properties. To use this method, the application fetches an initialized OrdDoc object from the database, calls this method to load the document into the database, and then updates the OrdDoc object in the database.

If the call to the setProperties( ) method fails because the document format is not recognized, this method sets the following properties:

Parameters

media

An object of type oracle.ord.im.OrdDoc into which the document will be loaded.

Return Value

None.

Exceptions

java.io.IOException

This exception is thrown if an error occurs while reading or writing the media data.

java.sql.SQLException

This exception is thrown if an unrecognized error occurs while storing the media data.

java.lang.IllegalStateException

This exception is thrown if the uploaded file is no longer available (for example: because it has been released).

Examples

None.


loadDoc(OrdDoc, byte[ ][ ], boolean)

Format

public void loadDoc(oracle.ord.im.OrdDoc media, byte[ ][ ] ctx, boolean setComments)

Description

Loads the uploaded file into an OrdDoc Java object and sets the properties using an application-supplied, format plug-in context. This method loads the document into the database and calls the OrdDoc setProperties( ) method to set the properties, such as the MIME type. The application provides the format plug-in context information and chooses whether or not to set the comments in the OrdDoc object. To use this method, the application fetches an initialized OrdDoc object from the database, calls this method to load the document into the database, and then updates the OrdDoc object in the database.

If the call to the setProperties( ) method fails because the document format is not recognized, this method sets the following properties:

Parameters

media

An object of type oracle.ord.im.OrdDoc object 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 object.

Return Value

None.

Exceptions

java.io.IOException

This exception is thrown if an error occurs while reading or writing the media data.

java.sql.SQLException

This exception is thrown if an unrecognized error occurs while storing the media data.

java.lang.IllegalStateException

This exception is thrown if the uploaded file is no longer available (for example: because it has been released).

Examples

None.


loadImage(OrdImage)

Format

public void loadImage(oracle.ord.im.OrdImage media)

Description

Loads the uploaded file into an OrdImage Java object and sets the properties based on the image contents. This method loads the image content into the database and calls the OrdImage setProperties( ) method to set the image's properties, such as the MIME type, length, height, and width. To use this method, the application fetches an initialized OrdImage object from the database, calls this method to load the image content into the database, and then updates the OrdImage object in the database.

If the call to the setProperties( ) method fails because the image format is not recognized, this method sets the following properties:

Parameters

media

An object of type oracle.ord.im.OrdImage into which the image data will be loaded.

Return Value

None.

Exceptions

java.io.IOException

This exception is thrown if an error occurs while reading or writing the media data.

java.sql.SQLException

This exception is thrown if an unrecognized error occurs while storing the media data.

java.lang.IllegalStateException

This exception is thrown if the uploaded file is no longer available (for example: because it has been released).

Examples

None.


loadImage(OrdImage, String)

Format

public void loadImage(oracle.ord.im.OrdImage media, String cmd)

Description

Loads the uploaded file into an OrdImage Java object and sets the properties according to an application-supplied command string. To use this method, the application fetches an initialized OrdImage object from the database, calls this method to load the image content into the database, and then updates the OrdImage object in the database.

Parameters

media

An object of type oracle.ord.im.OrdImage into which the uploaded image data will be loaded.

cmd

A String that specifies the properties to be set.

Return Value

None.

Exceptions

java.io.IOException

This exception is thrown if an error occurs while reading or writing the media data.

java.sql.SQLException

This exception is thrown if an unrecognized error occurs while storing the media data.

java.lang.IllegalStateException

This exception is thrown if the uploaded file is no longer available (for example: because it has been released).

Examples

None.


loadVideo(OrdVideo)

Format

public void loadVideo(oracle.ord.im.OrdVideo media)

Description

Loads the uploaded file into an OrdVideo Java object and sets the properties based on the video data. This method loads the video data into the database and calls the OrdVideo setProperties( ) method to set the properties, such as the MIME type. This method does not use any existing format plug-in context information and does not set any comments when setting the properties. To use this method, the application fetches an initialized OrdVideo object from the database, calls this method to load the video data into the database, and then updates the OrdVideo object in the database.

If the call to the setProperties( ) method fails because the video format is not recognized, this method sets the following properties:

Parameters

media

An object of type oracle.ord.im.OrdVideo into which the uploaded video data will be loaded.

Return Value

None.

Exceptions

java.io.IOException

This exception is thrown if an error occurs while reading or writing the media data.

java.sql.SQLException

This exception is thrown if an unrecognized error occurs while storing the media data.

java.lang.IllegalStateException

This exception is thrown if the uploaded file is no longer available (for example: because it has been released).

Examples

None.


loadVideo(OrdVideo, byte[ ][ ], boolean)

Format

public void loadVideo(oracle.ord.im.OrdVideo media, byte[ ][ ] ctx, boolean setComments)

Description

Loads the uploaded file into an OrdVideo Java object and sets the properties using an application-supplied, format plug-in context. This method loads the video data into the database and calls the OrdVideo setProperties( ) method to set the properties, such as the MIME type. The application provides the format plug-in context information and chooses whether or not to set the comments in the OrdVideo object. To use this method, the application fetches an initialized OrdVideo object from the database, calls this method to load the video data into the database, and then updates the OrdVideo object in the database.

If the call to the setProperties( ) method fails because the video format is not recognized, this method sets the following properties:

Parameters

media

An object of type oracle.ord.im.OrdVideo into which the uploaded 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 object.

Return Value

None.

Exceptions

java.io.IOException

This exception is thrown if an error occurs while reading or writing the media data.

java.sql.SQLException

This exception is thrown if an unrecognized error occurs while storing the media data.

java.lang.IllegalStateException

This exception is thrown if the uploaded file is no longer available (for example: because it has been released).

Examples

None.


release( )

Format

public void release( )

Description

Releases all resources held by an OrdHttpUploadFile object. Specifically, this method releases the memory used to hold the contents of an uploaded file or deletes the temporary file used to hold the contents of the uploaded file. An application can optimize memory usage by calling this method to release any allocated memory, making it a candidate for garbage collection, after the application has finished processing an uploaded file.

Parameters

None.

Return Value

None.

Exceptions

None.

Examples

None.