Java Doc for FileItem.java in  » Net » apache-common-FileUpload » org » apache » commons » fileupload » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » apache common FileUpload » org.apache.commons.fileupload 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.fileupload.FileItem

All known Subclasses:   org.apache.commons.fileupload.disk.DiskFileItem,
FileItem
public interface FileItem extends Serializable(Code)

This class represents a file or form item that was received within a multipart/form-data POST request.

After retrieving an instance of this class from a org.apache.commons.fileupload.FileUpload FileUpload instance (see org.apache.commons.fileupload.FileUpload.parseRequest(javax.servlet.http.HttpServletRequest) ), you may either request all contents of the file at once using FileItem.get() or request an java.io.InputStream InputStream with FileItem.getInputStream() and process the file without attempting to load it into memory, which may come handy with large files.

While this interface does not extend javax.activation.DataSource per se (to avoid a seldom used dependency), several of the defined methods are specifically defined with the same signatures as methods in that interface. This allows an implementation of this interface to also implement javax.activation.DataSource with minimal additional work.
author:
   Rafal Krzewski
author:
   Sean Legassick
author:
   Jason van Zyl
author:
   Martin Cooper
version:
   $Id: FileItem.java 479262 2006-11-26 03:09:24Z niallp $





Method Summary
 voiddelete()
     Deletes the underlying storage for a file item, including deleting any associated temporary disk file.
 byte[]get()
     Returns the contents of the file item as an array of bytes.
 StringgetContentType()
     Returns the content type passed by the browser or null if not defined.
 StringgetFieldName()
     Returns the name of the field in the multipart form corresponding to this file item.
 InputStreamgetInputStream()
     Returns an java.io.InputStream InputStream that can be used to retrieve the contents of the file.
 StringgetName()
     Returns the original filename in the client's filesystem, as provided by the browser (or other client software).
 OutputStreamgetOutputStream()
     Returns an java.io.OutputStream OutputStream that can be used for storing the contents of the file.
 longgetSize()
     Returns the size of the file item.
 StringgetString(String encoding)
     Returns the contents of the file item as a String, using the specified encoding.
 StringgetString()
     Returns the contents of the file item as a String, using the default character encoding.
 booleanisFormField()
     Determines whether or not a FileItem instance represents a simple form field.
 booleanisInMemory()
     Provides a hint as to whether or not the file contents will be read from memory.
 voidsetFieldName(String name)
     Sets the field name used to reference this file item.
 voidsetFormField(boolean state)
     Specifies whether or not a FileItem instance represents a simple form field.
 voidwrite(File file)
     A convenience method to write an uploaded item to disk.



Method Detail
delete
void delete()(Code)
Deletes the underlying storage for a file item, including deleting any associated temporary disk file. Although this storage will be deleted automatically when the FileItem instance is garbage collected, this method can be used to ensure that this is done at an earlier time, thus preserving system resources.



get
byte[] get()(Code)
Returns the contents of the file item as an array of bytes. The contents of the file item as an array of bytes.



getContentType
String getContentType()(Code)
Returns the content type passed by the browser or null if not defined. The content type passed by the browser or null ifnot defined.



getFieldName
String getFieldName()(Code)
Returns the name of the field in the multipart form corresponding to this file item. The name of the form field.



getInputStream
InputStream getInputStream() throws IOException(Code)
Returns an java.io.InputStream InputStream that can be used to retrieve the contents of the file. An java.io.InputStream InputStream that can beused to retrieve the contents of the file.
throws:
  IOException - if an error occurs.



getName
String getName()(Code)
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. The original filename in the client's filesystem.



getOutputStream
OutputStream getOutputStream() throws IOException(Code)
Returns an java.io.OutputStream OutputStream that can be used for storing the contents of the file. An java.io.OutputStream OutputStream that can be usedfor storing the contensts of the file.
throws:
  IOException - if an error occurs.



getSize
long getSize()(Code)
Returns the size of the file item. The size of the file item, in bytes.



getString
String getString(String encoding) throws UnsupportedEncodingException(Code)
Returns the contents of the file item as a String, using the specified encoding. This method uses FileItem.get() to retrieve the contents of the item.
Parameters:
  encoding - The character encoding to use. The contents of the item, as a string.
throws:
  UnsupportedEncodingException - if the requested characterencoding is not available.



getString
String getString()(Code)
Returns the contents of the file item as a String, using the default character encoding. This method uses FileItem.get() to retrieve the contents of the item. The contents of the item, as a string.



isFormField
boolean isFormField()(Code)
Determines whether or not a FileItem instance represents a simple form field. true if the instance represents a simple formfield; false if it represents an uploaded file.



isInMemory
boolean isInMemory()(Code)
Provides a hint as to whether or not the file contents will be read from memory. true if the file contents will be read from memory;false otherwise.



setFieldName
void setFieldName(String name)(Code)
Sets the field name used to reference this file item.
Parameters:
  name - The name of the form field.



setFormField
void setFormField(boolean state)(Code)
Specifies whether or not a FileItem instance represents a simple form field.
Parameters:
  state - true if the instance represents a simple formfield; false if it represents an uploaded file.



write
void write(File file) throws Exception(Code)
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.

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.
Parameters:
  file - The File into which the uploaded item shouldbe stored.
throws:
  Exception - if an error occurs.




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.