📄 fileitem.html
字号:
not defined.</DL></DD></DL><HR><A NAME="getName()"><!-- --></A><H3>getName</H3><PRE>java.lang.String <B>getName</B>()</PRE><DL><DD>Returns the original filename in the client's filesystem, as provided by the browser (or other client software). In most cases, this will be the base file name, without path information. However, some clients, such as the Opera browser, do include path information.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>The original filename in the client's filesystem.</DL></DD></DL><HR><A NAME="isInMemory()"><!-- --></A><H3>isInMemory</H3><PRE>boolean <B>isInMemory</B>()</PRE><DL><DD>Provides a hint as to whether or not the file contents will be read from memory.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if the file contents will be read from memory; <code>false</code> otherwise.</DL></DD></DL><HR><A NAME="getSize()"><!-- --></A><H3>getSize</H3><PRE>long <B>getSize</B>()</PRE><DL><DD>Returns the size of the file item.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>The size of the file item, in bytes.</DL></DD></DL><HR><A NAME="get()"><!-- --></A><H3>get</H3><PRE>byte[] <B>get</B>()</PRE><DL><DD>Returns the contents of the file item as an array of bytes.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>The contents of the file item as an array of bytes.</DL></DD></DL><HR><A NAME="getString(java.lang.String)"><!-- --></A><H3>getString</H3><PRE>java.lang.String <B>getString</B>(java.lang.String encoding) throws java.io.UnsupportedEncodingException</PRE><DL><DD>Returns the contents of the file item as a String, using the specified encoding. This method uses <A HREF="../../../../org/apache/commons/fileupload/FileItem.html#get()"><CODE>get()</CODE></A> to retrieve the contents of the item.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>encoding</CODE> - The character encoding to use.<DT><B>Returns:</B><DD>The contents of the item, as a string.<DT><B>Throws:</B><DD><CODE>java.io.UnsupportedEncodingException</CODE> - if the requested character encoding is not available.</DL></DD></DL><HR><A NAME="getString()"><!-- --></A><H3>getString</H3><PRE>java.lang.String <B>getString</B>()</PRE><DL><DD>Returns the contents of the file item as a String, using the default character encoding. This method uses <A HREF="../../../../org/apache/commons/fileupload/FileItem.html#get()"><CODE>get()</CODE></A> to retrieve the contents of the item.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>The contents of the item, as a string.</DL></DD></DL><HR><A NAME="write(java.io.File)"><!-- --></A><H3>write</H3><PRE>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 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.<P><DD><DL></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>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></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="getFieldName()"><!-- --></A><H3>getFieldName</H3><PRE>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></DL></DD><DD><DL><DT><B>Returns:</B><DD>The name of the form field.</DL></DD></DL><HR><A NAME="setFieldName(java.lang.String)"><!-- --></A><H3>setFieldName</H3><PRE>void <B>setFieldName</B>(java.lang.String name)</PRE><DL><DD>Sets the field name used to reference this file item.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - The name of the form field.</DL></DD></DL><HR><A NAME="isFormField()"><!-- --></A><H3>isFormField</H3><PRE>boolean <B>isFormField</B>()</PRE><DL><DD>Determines whether or not a <code>FileItem</code> instance represents a simple form field.<P><DD><DL></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.</DL></DD></DL><HR><A NAME="setFormField(boolean)"><!-- --></A><H3>setFormField</H3><PRE>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></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.</DL></DD></DL><HR><A NAME="getOutputStream()"><!-- --></A><H3>getOutputStream</H3><PRE>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></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><!-- ========= 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/FileItem.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"> <A HREF="../../../../org/apache/commons/fileupload/DiskFileUpload.html" title="class in org.apache.commons.fileupload"><B>PREV CLASS</B></A> <A HREF="../../../../org/apache/commons/fileupload/FileItemFactory.html" title="interface in org.apache.commons.fileupload"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/apache/commons/fileupload/FileItem.html" target="_top"><B>FRAMES</B></A> <A HREF="FileItem.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 | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <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 + -