|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.oreilly.servlet.multipart.Part
com.oreilly.servlet.multipart.FilePart
public class FilePart
A FilePart is an upload part which represents a
INPUT TYPE="file" form parameter. Note that because file
upload data arrives via a single InputStream, each FilePart's contents
must be read before moving onto the next part. Don't try to store a
FilePart object for later processing because by then their content will
have been passed by.
| 方法摘要 | |
|---|---|
String |
getContentType()
Returns the content type of the file data contained within. |
String |
getFileName()
Returns the name that the file was stored with on the remote system, or null if the user didn't enter a file to be uploaded. |
String |
getFilePath()
Returns the full path and name of the file on the remote system, or null if the user didn't enter a file to be uploaded. |
InputStream |
getInputStream()
Returns an input stream which contains the contents of the file supplied. |
boolean |
isFile()
Returns true to indicate this part is a file. |
void |
setRenamePolicy(FileRenamePolicy policy)
Puts in place the specified policy for handling file name collisions. |
long |
writeTo(File fileOrDirectory)
Write this file part to a file or directory. |
long |
writeTo(OutputStream out)
Write this file part to the given output stream. |
| 从类 com.oreilly.servlet.multipart.Part 继承的方法 |
|---|
getName, isParam |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 方法详细信息 |
|---|
public void setRenamePolicy(FileRenamePolicy policy)
public String getFileName()
null if the user didn't enter a file to be uploaded.
Note: this is not the same as the name of the form parameter used to
transmit the file; that is available from the getName
method. Further note: if file rename logic is in effect, the file
name can change during the writeTo() method when there's a collision
with another file of the same name in the same directory. If this
matters to you, be sure to pay attention to when you call the method.
null.Part.getName()public String getFilePath()
null if the user didn't enter a file to be uploaded.
If path information was not supplied by the remote system, this method
will return the same as getFileName().
null.Part.getName()public String getContentType()
public InputStream getInputStream()
0 bytes in the input stream.
It's important to read the contents of the InputStream
immediately and in full before proceeding to process the
next part. The contents will otherwise be lost on moving
to the next part.
public long writeTo(File fileOrDirectory)
throws IOException
IOException - if an input or output exception has occurred.
public long writeTo(OutputStream out)
throws IOException
IOException - if an input or output exception has occurred.public boolean isFile()
true to indicate this part is a file.
Part 中的 isFile
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||