com.evermind.io
Class FilePostParser
java.lang.Object
|
+--com.evermind.io.FilePostParser
- All Implemented Interfaces:
- java.util.Enumeration
- public class FilePostParser
- extends java.lang.Object
- implements java.util.Enumeration
FilePostParser
|
Constructor Summary |
FilePostParser(java.io.InputStream in,
int length)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FilePostParser
public FilePostParser(java.io.InputStream in,
int length)
throws java.io.IOException
getParser
public static FilePostParser getParser(java.io.InputStream in,
int length)
throws java.io.IOException
- FilePostParser is used to handle HTTP file uploads from browsers.
An example:
Enumeration enumeration = new FilePostParser(request.getInputStream, request.getLength());
while(enumeration.hasMoreElements())
{
Object element = enumeration.nextElement();
if(element instanceof Map.Entry)
{
Map.Entry entry = (Map.Entry)element;
//Handle Map.Entry
System.out.println("Key: " + entry.getKey());
System.out.println("Value: " + entry.getValue());
}
else if(element instanceof InputStream)
{
InputStream in = (InputStream)element;
//Do what you wish with the input (the file(s))
}
}
hasMoreElements
public boolean hasMoreElements()
- Specified by:
hasMoreElements in interface java.util.Enumeration
nextElement
public java.lang.Object nextElement()
- Specified by:
nextElement in interface java.util.Enumeration