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 RequestParameter
public java.lang.String getFileName()
RequestParameter
getFileName
in interface RequestParameter
public boolean isFormField()
RequestParameter
isFormField
in interface RequestParameter
true
if the instance represents a simple form
field; false
if it represents an uploaded file.public java.lang.String getName()
getName
in interface RequestParameter
RequestParameter
public java.lang.String getContentType()
RequestParameter
null
if
not defined.getContentType
in interface RequestParameter
null
if
not defined.public byte[] get()
RequestParameter
get
in interface RequestParameter
public java.lang.String getString()
RequestParameter
RequestParameter.get()
to retrieve the
contents of the item.getString
in interface RequestParameter
public java.lang.String getString(java.lang.String encoding)
RequestParameter
RequestParameter.get()
to retrieve the contents
of the item.getString
in interface RequestParameter
encoding
- The character encoding to use.public long getSize()
RequestParameter
getSize
in interface RequestParameter
Copyright © 2010 - 2020 Adobe. All Rights Reserved