?? diskfileitem.html
字號:
write</H3><PRE>public void <B>write</B>(java.io.File file) throws java.lang.Exception</PRE><DL><DD>A convenience method to write an uploaded item to disk. The client code is not concerned with whether or not the item is stored in memory, or on disk in a temporary location. They just want to write the uploaded item to a file. <p> This implementation first attempts to rename the uploaded item to the specified destination file, if the item was originally written to disk. Otherwise, the data will be copied to the specified file. <p> This method is only guaranteed to work <em>once</em>, the first time it is invoked for a particular item. This is because, in the event that the method renames a temporary file, that file will no longer be available to copy or rename again at a later time.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html#write(java.io.File)">write</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html" title="interface in org.apache.commons.fileupload">FileItem</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>file</CODE> - The <code>File</code> into which the uploaded item should be stored.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if an error occurs.</DL></DD></DL><HR><A NAME="delete()"><!-- --></A><H3>delete</H3><PRE>public void <B>delete</B>()</PRE><DL><DD>Deletes the underlying storage for a file item, including deleting any associated temporary disk file. Although this storage will be deleted automatically when the <code>FileItem</code> instance is garbage collected, this method can be used to ensure that this is done at an earlier time, thus preserving system resources.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html#delete()">delete</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html" title="interface in org.apache.commons.fileupload">FileItem</A></CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="getFieldName()"><!-- --></A><H3>getFieldName</H3><PRE>public java.lang.String <B>getFieldName</B>()</PRE><DL><DD>Returns the name of the field in the multipart form corresponding to this file item.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html#getFieldName()">getFieldName</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html" title="interface in org.apache.commons.fileupload">FileItem</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>The name of the form field.<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/commons/fileupload/disk/DiskFileItem.html#setFieldName(java.lang.String)"><CODE>setFieldName(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="setFieldName(java.lang.String)"><!-- --></A><H3>setFieldName</H3><PRE>public void <B>setFieldName</B>(java.lang.String fieldName)</PRE><DL><DD>Sets the field name used to reference this file item.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html#setFieldName(java.lang.String)">setFieldName</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html" title="interface in org.apache.commons.fileupload">FileItem</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>fieldName</CODE> - The name of the form field.<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/commons/fileupload/disk/DiskFileItem.html#getFieldName()"><CODE>getFieldName()</CODE></A></DL></DD></DL><HR><A NAME="isFormField()"><!-- --></A><H3>isFormField</H3><PRE>public boolean <B>isFormField</B>()</PRE><DL><DD>Determines whether or not a <code>FileItem</code> instance represents a simple form field.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html#isFormField()">isFormField</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html" title="interface in org.apache.commons.fileupload">FileItem</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if the instance represents a simple form field; <code>false</code> if it represents an uploaded file.<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/commons/fileupload/disk/DiskFileItem.html#setFormField(boolean)"><CODE>setFormField(boolean)</CODE></A></DL></DD></DL><HR><A NAME="setFormField(boolean)"><!-- --></A><H3>setFormField</H3><PRE>public void <B>setFormField</B>(boolean state)</PRE><DL><DD>Specifies whether or not a <code>FileItem</code> instance represents a simple form field.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html#setFormField(boolean)">setFormField</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html" title="interface in org.apache.commons.fileupload">FileItem</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>state</CODE> - <code>true</code> if the instance represents a simple form field; <code>false</code> if it represents an uploaded file.<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/commons/fileupload/disk/DiskFileItem.html#isFormField()"><CODE>isFormField()</CODE></A></DL></DD></DL><HR><A NAME="getOutputStream()"><!-- --></A><H3>getOutputStream</H3><PRE>public java.io.OutputStream <B>getOutputStream</B>() throws java.io.IOException</PRE><DL><DD>Returns an <CODE>OutputStream</CODE> that can be used for storing the contents of the file.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html#getOutputStream()">getOutputStream</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItem.html" title="interface in org.apache.commons.fileupload">FileItem</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>An <CODE>OutputStream</CODE> that can be used for storing the contensts of the file.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an error occurs.</DL></DD></DL><HR><A NAME="getStoreLocation()"><!-- --></A><H3>getStoreLocation</H3><PRE>public java.io.File <B>getStoreLocation</B>()</PRE><DL><DD>Returns the <CODE>File</CODE> object for the <code>FileItem</code>'s data's temporary location on the disk. Note that for <code>FileItem</code>s that have their data stored in memory, this method will return <code>null</code>. When handling large files, you can use <CODE>File.renameTo(java.io.File)</CODE> to move the file to new location without copying the data, if the source and destination locations reside within the same logical volume.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>The data file, or <code>null</code> if the data is stored in memory.</DL></DD></DL><HR><A NAME="finalize()"><!-- --></A><H3>finalize</H3><PRE>protected void <B>finalize</B>()</PRE><DL><DD>Removes the file contents from the temporary storage.<P><DD><DL><DT><B>Overrides:</B><DD><CODE>finalize</CODE> in class <CODE>java.lang.Object</CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="getTempFile()"><!-- --></A><H3>getTempFile</H3><PRE>protected java.io.File <B>getTempFile</B>()</PRE><DL><DD>Creates and returns a <CODE>File</CODE> representing a uniquely named temporary file in the configured repository path. The lifetime of the file is tied to the lifetime of the <code>FileItem</code> instance; the file will be deleted when the instance is garbage collected.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>The <CODE>File</CODE> to be used for temporary storage.</DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public java.lang.String <B>toString</B>()</PRE><DL><DD>Returns a string representation of this object.<P><DD><DL><DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>a string representation of this object.</DL></DD></DL><HR><A NAME="getHeaders()"><!-- --></A><H3>getHeaders</H3><PRE>public <A HREF="../../../../../org/apache/commons/fileupload/FileItemHeaders.html" title="interface in org.apache.commons.fileupload">FileItemHeaders</A> <B>getHeaders</B>()</PRE><DL><DD>Returns the file item headers.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItemHeadersSupport.html#getHeaders()">getHeaders</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItemHeadersSupport.html" title="interface in org.apache.commons.fileupload">FileItemHeadersSupport</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>The file items headers.</DL></DD></DL><HR><A NAME="setHeaders(org.apache.commons.fileupload.FileItemHeaders)"><!-- --></A><H3>setHeaders</H3><PRE>public void <B>setHeaders</B>(<A HREF="../../../../../org/apache/commons/fileupload/FileItemHeaders.html" title="interface in org.apache.commons.fileupload">FileItemHeaders</A> pHeaders)</PRE><DL><DD>Sets the file item headers.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItemHeadersSupport.html#setHeaders(org.apache.commons.fileupload.FileItemHeaders)">setHeaders</A></CODE> in interface <CODE><A HREF="../../../../../org/apache/commons/fileupload/FileItemHeadersSupport.html" title="interface in org.apache.commons.fileupload">FileItemHeadersSupport</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pHeaders</CODE> - The file items headers.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DiskFileItem.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../../../../org/apache/commons/fileupload/disk/DiskFileItemFactory.html" title="class in org.apache.commons.fileupload.disk"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/apache/commons/fileupload/disk/DiskFileItem.html" target="_top"><B>FRAMES</B></A> <A HREF="DiskFileItem.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR>Copyright ? 2002-2008 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.</BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -