public class FileRequestParameter extends java.lang.Object implements RequestParameter
| Constructor and Description |
|---|
FileRequestParameter(java.lang.String fileName,
byte[] fileBytes,
java.lang.String contentType) |
FileRequestParameter(java.lang.String fileName,
Resource fileResource) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
get()
Returns the contents of the parameter as an array of bytes.
|
java.lang.String |
getContentType()
Returns the content type passed by the browser or
null if
not defined. |
java.lang.String |
getFileName()
Returns the original filename in the client's filesystem, as provided by
the browser (or other client software).
|
java.io.InputStream |
getInputStream()
Returns an InputStream that can be used to retrieve the contents of the
file.
|
java.lang.String |
getName() |
long |
getSize()
Returns the size in bytes of the parameter.
|
java.lang.String |
getString()
Returns the contents of the parameter as a String, using the default
character encoding.
|
java.lang.String |
getString(java.lang.String encoding)
Returns the contents of the parameter as a String, using the specified
encoding.
|
boolean |
isFormField()
Determines whether or not this instance represents a simple form field or
an uploaded file.
|
public FileRequestParameter(java.lang.String fileName,
Resource fileResource)
public FileRequestParameter(java.lang.String fileName,
byte[] fileBytes,
java.lang.String contentType)
public java.io.InputStream getInputStream()
RequestParameter
Each call to this method returns a new InputStream to the
request parameter data. Make sure to close the stream to prevent
leaking resources.
getInputStream in interface RequestParameterpublic java.lang.String getFileName()
RequestParametergetFileName in interface RequestParameterpublic boolean isFormField()
RequestParameterisFormField in interface RequestParametertrue if the instance represents a simple form
field; false if it represents an uploaded file.public java.lang.String getName()
getName in interface RequestParameterRequestParameterpublic java.lang.String getContentType()
RequestParameternull if
not defined.getContentType in interface RequestParameternull if
not defined.public byte[] get()
RequestParameterget in interface RequestParameterpublic java.lang.String getString()
RequestParameterRequestParameter.get() to retrieve the
contents of the item.getString in interface RequestParameterpublic java.lang.String getString(java.lang.String encoding)
RequestParameterRequestParameter.get() to retrieve the contents
of the item.getString in interface RequestParameterencoding - The character encoding to use.public long getSize()
RequestParametergetSize in interface RequestParameterCopyright © 2010 - 2023 Adobe. All Rights Reserved