Constructor and Description |
---|
CommonsFileUploadPart(FileItem fileItem,
java.io.File location) |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Deletes the underlying storage for a file item, including deleting any
associated temporary disk file.
|
java.lang.String |
getContentType()
Gets the content type of this part.
|
java.lang.String |
getHeader(java.lang.String name)
Returns the value of the specified mime header
as a
String . |
java.util.Collection<java.lang.String> |
getHeaderNames()
Gets the header names of this Part.
|
java.util.Collection<java.lang.String> |
getHeaders(java.lang.String name)
Gets the values of the Part header with the given name.
|
java.io.InputStream |
getInputStream()
Gets the content of this part as an InputStream
|
java.lang.String |
getName()
Gets the name of this part
|
long |
getSize()
Returns the size of this fille.
|
java.lang.String |
getString(java.lang.String encoding) |
java.lang.String |
getSubmittedFileName()
Gets the file name specified by the client
|
void |
write(java.lang.String fileName)
A convenience method to write this uploaded item to disk.
|
public CommonsFileUploadPart(FileItem fileItem, java.io.File location)
public void delete() throws java.io.IOException
Part
public java.lang.String getContentType()
Part
getContentType
in interface Part
public java.lang.String getHeader(java.lang.String name)
Part
String
. If the Part did not include a header
of the specified name, this method returns null
.
If there are multiple headers with the same name, this method
returns the first header in the part.
The header name is case insensitive. You can use
this method with any request header.public java.util.Collection<java.lang.String> getHeaderNames()
Part
Some servlet containers do not allow
servlets to access headers using this method, in
which case this method returns null
Any changes to the returned Collection
must not
affect this Part
.
getHeaderNames
in interface Part
Collection
of the header
names of this Partpublic java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
Part
Any changes to the returned Collection
must not
affect this Part
.
Part header names are case insensitive.
getHeaders
in interface Part
name
- the header name whose values to returnCollection
of the values of
the header with the given namepublic java.io.InputStream getInputStream() throws java.io.IOException
Part
getInputStream
in interface Part
java.io.IOException
- If an error occurs in retrieving the content
as an InputStreampublic java.lang.String getName()
Part
public long getSize()
Part
public void write(java.lang.String fileName) throws java.io.IOException
Part
This method is not guaranteed to succeed if called more than once for the same part. This allows a particular implementation to use, for example, file renaming, where possible, rather than copying all of the underlying data, thus gaining a significant performance benefit.
write
in interface Part
fileName
- The location into which the uploaded part should
be stored. The value may be a file name or a path. The actual
location of the file in the filesystem is relative to MultipartConfigElement.getLocation()
. Absolute
paths are used as provided and are relative to
getLocation()
. Note: that this is a system
dependent string and URI notation may not be acceptable on all
systems. For portability, this string should be generated with
the File or Path APIs.java.io.IOException
- if an error occurs.public java.lang.String getString(java.lang.String encoding) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public java.lang.String getSubmittedFileName()
Part
getSubmittedFileName
in interface Part