Constructor and Description |
---|
ApplicationPart(FileItem fileItem,
java.io.File location) |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Deletes the underlying storage for a part, including deleting any
associated temporary disk file.
|
java.lang.String |
getContentType()
Obtain the content type passed by the browser.
|
java.lang.String |
getHeader(java.lang.String name)
Obtains the value of the specified part header as a String.
|
java.util.Collection<java.lang.String> |
getHeaderNames()
Get the header names provided for this part.
|
java.util.Collection<java.lang.String> |
getHeaders(java.lang.String name)
Obtain all the values of the specified part header.
|
java.io.InputStream |
getInputStream()
Obtain an
InputStream that can be used to retrieve the
contents of the file. |
java.lang.String |
getName()
Obtain the name of the field in the multipart form corresponding to this
part.
|
long |
getSize()
Obtain the size of this part.
|
java.lang.String |
getString(java.lang.String encoding) |
java.lang.String |
getSubmittedFileName()
If this part represents an uploaded file, gets the file name submitted
in the upload.
|
void |
write(java.lang.String fileName)
A convenience method to write an uploaded part to disk.
|
public ApplicationPart(FileItem fileItem, java.io.File location)
public void delete() throws java.io.IOException
javax.servlet.http.Part
Containers are only required to delete the associated storage when the Part instance is garbage collected. Apache Tomcat will delete the associated storage when the associated request has finished processing. Behaviour of other containers may be different.
public java.lang.String getContentType()
javax.servlet.http.Part
getContentType
in interface Part
null
if
not defined.public java.lang.String getHeader(java.lang.String name)
javax.servlet.http.Part
public java.util.Collection<java.lang.String> getHeaderNames()
javax.servlet.http.Part
getHeaderNames
in interface Part
public java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
javax.servlet.http.Part
getHeaders
in interface Part
name
- The name of the header of interest. The header name is case
insensitive.public java.io.InputStream getInputStream() throws java.io.IOException
javax.servlet.http.Part
InputStream
that can be used to retrieve the
contents of the file.getInputStream
in interface Part
java.io.IOException
- if an I/O occurs while obtaining the streampublic java.lang.String getName()
javax.servlet.http.Part
public long getSize()
javax.servlet.http.Part
public void write(java.lang.String fileName) throws java.io.IOException
javax.servlet.http.Part
write
in interface Part
fileName
- The location into which the uploaded part should be
stored. Relative locations are relative to MultipartConfigElement.getLocation()
java.io.IOException
- if an I/O occurs while attempting to write the partpublic java.lang.String getString(java.lang.String encoding) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public java.lang.String getSubmittedFileName()
javax.servlet.http.Part
null
if no file name is available or if
this part is not a file upload.getSubmittedFileName
in interface Part
null
.Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.