Source Code Cross Referenced for FileItem.java in  » J2EE » WiSerFramework » de » ug2t » extTools » httpFileUpLoad » 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 » J2EE » WiSerFramework » de.ug2t.extTools.httpFileUpLoad 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Header: /home/cvs/jakarta-commons/fileupload/src/java/org/apache/commons/fileupload/FileItem.java,v 1.15 2003/06/01 17:33:24 martinc Exp $
003:         * $Revision: 1.15 $
004:         * $Date: 2003/06/01 17:33:24 $
005:         *
006:         * ====================================================================
007:         *
008:         * The Apache Software License, Version 1.1
009:         *
010:         * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
011:         * reserved.
012:         *
013:         * Redistribution and use in source and binary forms, with or without
014:         * modification, are permitted provided that the following conditions
015:         * are met:
016:         *
017:         * 1. Redistributions of source code must retain the above copyright
018:         *    notice, this list of conditions and the following disclaimer.
019:         *
020:         * 2. Redistributions in binary form must reproduce the above copyright
021:         *    notice, this list of conditions and the following disclaimer in
022:         *    the documentation and/or other materials provided with the
023:         *    distribution.
024:         *
025:         * 3. The end-user documentation included with the redistribution, if
026:         *    any, must include the following acknowlegement:
027:         *       "This product includes software developed by the
028:         *        Apache Software Foundation (http://www.apache.org/)."
029:         *    Alternately, this acknowlegement may appear in the software itself,
030:         *    if and wherever such third-party acknowlegements normally appear.
031:         *
032:         * 4. The names "The Jakarta Project", "Commons", and "Apache Software
033:         *    Foundation" must not be used to endorse or promote products derived
034:         *    from this software without prior written permission. For written
035:         *    permission, please contact apache@apache.org.
036:         *
037:         * 5. Products derived from this software may not be called "Apache"
038:         *    nor may "Apache" appear in their names without prior written
039:         *    permission of the Apache Group.
040:         *
041:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
042:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
043:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
044:         * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
045:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
046:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
047:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
048:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
049:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
050:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
051:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
052:         * SUCH DAMAGE.
053:         * ====================================================================
054:         *
055:         * This software consists of voluntary contributions made by many
056:         * individuals on behalf of the Apache Software Foundation.  For more
057:         * information on the Apache Software Foundation, please see
058:         * <http://www.apache.org/>.
059:         *
060:         */
061:
062:        package de.ug2t.extTools.httpFileUpLoad;
063:
064:        import java.io.*;
065:
066:        /**
067:         * <p>
068:         * This class represents a file or form item that was received within a
069:         * <code>multipart/form-data</code> POST request.
070:         * 
071:         * <p>
072:         * After retrieving an instance of this class from a {@link
073:         * org.apache.commons.fileupload.FileUpload FileUpload} instance (see
074:         * {@link org.apache.commons.fileupload.FileUpload
075:         * #parseRequest(javax.servlet.http.HttpServletRequest)}), you may either
076:         * request all contents of the file at once using {@link #get()} or request an
077:         * {@link java.io.InputStream InputStream} with {@link #getInputStream()} and
078:         * process the file without attempting to load it into memory, which may come
079:         * handy with large files.
080:         * 
081:         * <p>
082:         * While this interface does not extend <code>javax.activation.DataSource</code>
083:         * per se (to avoid a seldom used dependency), several of the defined methods
084:         * are specifically defined with the same signatures as methods in that
085:         * interface. This allows an implementation of this interface to also implement
086:         * <code>javax.activation.DataSource</code> with minimal additional Work.
087:         * 
088:         * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
089:         * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
090:         * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
091:         * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
092:         * 
093:         * @version $Id: FileItem.java,v 1.15 2003/06/01 17:33:24 martinc Exp $
094:         */
095:        public interface FileItem extends Serializable {
096:
097:            // ------------------------------- Methods from javax.activation.DataSource
098:
099:            /**
100:             * Returns an {@link java.io.InputStream InputStream} that can be used to
101:             * retrieve the contents of the file.
102:             * 
103:             * @return An {@link java.io.InputStream InputStream} that can be used to
104:             *         retrieve the contents of the file.
105:             * 
106:             * @exception IOException
107:             *              if an error occurs.
108:             */
109:            InputStream getInputStream() throws IOException;
110:
111:            /**
112:             * Returns the content type passed by the browser or <code>null</code> if
113:             * not defined.
114:             * 
115:             * @return The content type passed by the browser or <code>null</code> if
116:             *         not defined.
117:             */
118:            String getContentType();
119:
120:            /**
121:             * Returns the original filename in the client's filesystem, as provided by
122:             * the browser (or other client software). In most cases, this will be the
123:             * base file name, without path information. However, some clients, such as
124:             * the Opera browser, do include path information.
125:             * 
126:             * @return The original filename in the client's filesystem.
127:             */
128:            String getName();
129:
130:            // ------------------------------------------------------- FileItem methods
131:
132:            /**
133:             * Provides a hint as to whether or not the file contents will be read from
134:             * memory.
135:             * 
136:             * @return <code>true</code> if the file contents will be read from memory;
137:             *         <code>false</code> otherwise.
138:             */
139:            boolean isInMemory();
140:
141:            /**
142:             * Returns the size of the file item.
143:             * 
144:             * @return The size of the file item, in bytes.
145:             */
146:            long getSize();
147:
148:            /**
149:             * Returns the contents of the file item as an array of bytes.
150:             * 
151:             * @return The contents of the file item as an array of bytes.
152:             */
153:            byte[] get();
154:
155:            /**
156:             * Returns the contents of the file item as a String, using the specified
157:             * encoding. This method uses {@link #get()} to retrieve the contents of the
158:             * item.
159:             * 
160:             * @param encoding
161:             *          The character encoding to use.
162:             * 
163:             * @return The contents of the item, as a string.
164:             * 
165:             * @exception UnsupportedEncodingException
166:             *              if the requested character encoding is not available.
167:             */
168:            String getString(String encoding)
169:                    throws UnsupportedEncodingException;
170:
171:            /**
172:             * Returns the contents of the file item as a String, using the default
173:             * character encoding. This method uses {@link #get()} to retrieve the
174:             * contents of the item.
175:             * 
176:             * @return The contents of the item, as a string.
177:             */
178:            String getString();
179:
180:            /**
181:             * A convenience method to write an uploaded item to disk. The client code is
182:             * not concerned with whether or not the item is stored in memory, or on disk
183:             * in a temporary location. They just want to write the uploaded item to a
184:             * file.
185:             * <p>
186:             * This method is not guaranteed to succeed if called more than once for the
187:             * same item. This allows a particular implementation to use, for example,
188:             * file renaming, where possible, rather than copying all of the underlying
189:             * data, thus gaining a significant performance benefit.
190:             * 
191:             * @param file
192:             *          The <code>File</code> into which the uploaded item should be
193:             *          stored.
194:             * 
195:             * @exception Exception
196:             *              if an error occurs.
197:             */
198:            void write(File file) throws Exception;
199:
200:            /**
201:             * Deletes the underlying storage for a file item, including deleting any
202:             * associated temporary disk file. Although this storage will be deleted
203:             * automatically when the <code>FileItem</code> instance is garbage
204:             * collected, this method can be used to ensure that this is done at an
205:             * earlier time, thus preserving system resources.
206:             */
207:            void delete();
208:
209:            /**
210:             * Returns the name of the field in the multipart form corresponding to this
211:             * file item.
212:             * 
213:             * @return The name of the form field.
214:             */
215:            String getFieldName();
216:
217:            /**
218:             * Sets the field name used to reference this file item.
219:             * 
220:             * @param name
221:             *          The name of the form field.
222:             */
223:            void setFieldName(String name);
224:
225:            /**
226:             * Determines whether or not a <code>FileItem</code> instance represents a
227:             * simple form field.
228:             * 
229:             * @return <code>true</code> if the instance represents a simple form field;
230:             *         <code>false</code> if it represents an uploaded file.
231:             */
232:            boolean isFormField();
233:
234:            /**
235:             * Specifies whether or not a <code>FileItem</code> instance represents a
236:             * simple form field.
237:             * 
238:             * @param state
239:             *          <code>true</code> if the instance represents a simple form
240:             *          field; <code>false</code> if it represents an uploaded file.
241:             */
242:            void setFormField(boolean state);
243:
244:            /**
245:             * Returns an {@link java.io.OutputStream OutputStream} that can be used for
246:             * storing the contents of the file.
247:             * 
248:             * @return An {@link java.io.OutputStream OutputStream} that can be used for
249:             *         storing the contensts of the file.
250:             * 
251:             * @exception IOException
252:             *              if an error occurs.
253:             */
254:            OutputStream getOutputStream() throws IOException;
255:
256:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.