|
Oracle9i Business Components for Java InterMedia API Reference Oracle9i JDeveloper (9.0.4) B10394-01 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.ord.im.OrdHttpUploadFile
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 parsed from such a request 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 OrdImage, OrdAudio, OrdVideo or OrdDoc object in a database.
Note that every input field of type FILE in an HTML form will produce a parameter of type OrdUploadFile, whether or not a user enters a valid file name into such a field. Depending on the requirements, applications can test either the length of the file name, the length of the content, or a combination, 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 length of the file name String returned by getOriginalFileName()
will be zero. However, if a user enters an invalid file name or the name of an empty (zero-length) file, then the content length returned by getContentLength()
will be zero, even though the length of the file name will be non-zero.
Method Summary | |
int |
getContentLength() Returns the length of the uploaded media. |
java.io.InputStream |
getInputStream() Returns an InputStream object, which can be used to read uploaded data directly. |
java.lang.String |
getMimeType() Returns the MIME type 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, just the file name and the extension. |
java.io.File |
getTempFile() Internal: Applications should not use this method. |
void |
loadAudio(OrdAudio audio) Loads the uploaded file into an OrdAudio Java object and sets the properties based on the audio data. |
void |
loadAudio(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 file into a BLOB. |
void |
loadDoc(OrdDoc doc) Loads the uploaded file into an OrdDoc Java object and sets the properties based on the contents of the document. |
void |
loadDoc(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(OrdImage image) Loads the uploaded file into an OrdImage Java object and sets the properties based on the image contents. |
void |
loadImage(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(OrdVideo video) Loads the uploaded file into an OrdVideo Java object and sets the properties based on the video data. |
void |
loadVideo(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 the 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()
String
.public int getContentLength()
public java.io.InputStream getInputStream() throws java.io.IOException
OrdImage dbImage = (OrdImage)rset.getCustomDatum( 1, OrdImage.getFactory() ); OrdHttpUploadFile uploadImage = formData.getFileParameter( "photo" ); InputStream photoInputStream = uploadImage.getInputStream(); try { dbImage.loadDataFromInputStream( photoInputStream ); } finally { photoInputStream.close(); }
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(OrdImage image) throws java.sql.SQLException, java.io.IOException
image
- an oracle.ord.im.OrdImage
object into which the image is to be loaded.java.io.IOException
- if an error occurs reading or writing the image data.java.sql.SQLException
- if an unrecognized error occurs storing the image.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadImage(OrdImage image, java.lang.String cmd) throws java.sql.SQLException, java.io.IOException
image
- an oracle.ord.im.OrdImage
object into which the image is to be loaded.cmd
- a String
that specifies the properties to set.java.io.IOException
- if an error occurs reading or writing the image data.java.sql.SQLException
- if an unrecognized error occurs storing the image.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadAudio(OrdAudio audio) throws java.sql.SQLException, java.io.IOException
audio
- an oracle.ord.im.OrdAudio
object into which the audio data is to be loaded.java.io.IOException
- if an error occurs reading or writing the audio data.java.sql.SQLException
- if an unrecognized error occurs storing the audio data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadAudio(OrdAudio audio, byte[][] ctx, boolean setComments) throws java.sql.SQLException, java.io.IOException
audio
- an oracle.ord.im.OrdAudio
object into which the audio data is to 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 audio data.java.sql.SQLException
- if an unrecognized error occurs storing the audio data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadVideo(OrdVideo video) throws java.sql.SQLException, java.io.IOException
video
- an oracle.ord.im.OrdVideo
object into which the video data is to be loaded.java.io.IOException
- if an error occurs reading or writing the video data.java.sql.SQLException
- if an unrecognized error occurs storing the video data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadVideo(OrdVideo video, byte[][] ctx, boolean setComments) throws java.sql.SQLException, java.io.IOException
video
- an oracle.ord.im.OrdVideo
object into which the video data is to 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 video data.java.sql.SQLException
- if an unrecognized error occurs storing the video data.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadDoc(OrdDoc doc) throws java.sql.SQLException, java.io.IOException
doc
- an oracle.ord.im.OrdDoc
object into which the document is to be loaded.java.io.IOException
- if an error occurs reading or writing the document.java.sql.SQLException
- if an unrecognized error occurs storing the document.java.lang.IllegalStateException
- if the uploaded file is no longer available because it has been released.public void loadDoc(OrdDoc doc, byte[][] ctx, boolean setComments) throws java.sql.SQLException, java.io.IOException
doc
- an oracle.ord.im.OrdDoc
object into which the document is to 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 document.java.sql.SQLException
- if an unrecognized error occurs storing the document.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
- a BLOB
into which the data is to be loaded.java.io.IOException
- if an error occurs reading or writing the data.java.sql.SQLException
- if an unrecognized error occurs storing the 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()
|
Oracle9i Business Components for Java InterMedia API Reference Oracle9i JDeveloper (9.0.4) B10394-01 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |