public abstract class FileItemBase extends Object implements FileItem
This class represents a file or form item that was received within a
multipart/form-data POST request.
| 构造器和说明 |
|---|
FileItemBase(FileItemStream stream) |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
get()
Returns the contents of the file item as an array of bytes.
|
String |
getContentType()
Returns the content type passed by the browser or
null if not defined. |
String |
getFieldName()
Returns the name of the field in the multipart form corresponding to this file item.
|
FileItemHeaders |
getHeaders()
Returns the collection of headers defined locally within this item.
|
String |
getName()
Returns the original filename in the client's filesystem, as provided by
the browser (or other client software).
|
String |
getString()
Returns the contents of the file item as a String, using the default
character encoding.
|
String |
getString(String encoding)
Returns the contents of the file item as a String, using the specified
encoding.
|
boolean |
isFormField()
Determines whether or not a
FileItem instance represents a simple form field. |
void |
writeTo(File outputFile)
A convenience method to write an uploaded item to disk.
|
void |
writeTo(OutputStream outStream)
A convenience method to write an uploaded item to disk.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeleteOrSkip, getSizeopenStreampublic FileItemBase(FileItemStream stream)
public FileItemHeaders getHeaders()
FileItemStreamgetHeaders 在接口中 FileItemStreamFileItemHeaders present for this item.public String getContentType()
FileItemStreamnull if not defined.getContentType 在接口中 FileItemStreamnull if not defined.public String getName()
FileItemStreamgetName 在接口中 FileItemStreampublic String getFieldName()
FileItemStreamgetFieldName 在接口中 FileItemStreampublic boolean isFormField()
FileItemStreamFileItem instance represents a simple form field.isFormField 在接口中 FileItemStreamtrue if the instance represents a simple form
field; false if it represents an uploaded file.public byte[] get()
throws IOException
FileItemget 在接口中 FileItemIOExceptionpublic String getString(String encoding) throws IOException
FileItemFileItem.get() to retrieve the
contents of the item.getString 在接口中 FileItemencoding - The character encoding to use.UnsupportedEncodingException - if the requested character encoding is not available.IOExceptionpublic String getString() throws IOException
FileItemFileItem.get() to retrieve the
contents of the item.getString 在接口中 FileItemIOExceptionpublic void writeTo(File outputFile) throws IOException
FileItemThis method is not guaranteed to succeed if called more than once for the same item. 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.
writeTo 在接口中 FileItemoutputFile - The File into which the uploaded item should be stored.IOExceptionpublic void writeTo(OutputStream outStream) throws IOException
FileItemThis method is not guaranteed to succeed if called more than once for the same item. 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.
writeTo 在接口中 FileItemoutStream - The OutputStream into which the uploaded item should be stored.IOException