webwork/src/main/webwork/multipart/parser EmptyInputStream.java,NONE,1.1 MaxReadBytesException.java,NONE,1.1 MultipartListener.java,NONE,1.1 MultipartRequest.java,NONE,1.1
[email protected] Sat, 27 Dec 2003 15:04:26 -0800
| Newsgroups | gmane.comp.java.open-symphony.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/opensymphony/webwork/src/main/webwork/multipart/parser
In directory sc8-pr-cvs1:/tmp/cvs-serv7341/src/main/webwork/multipart/parser
Added Files:
EmptyInputStream.java MaxReadBytesException.java
MultipartListener.java MultipartRequest.java
Log Message:
Multipart parser, moved here from pell
--- NEW FILE: EmptyInputStream.java ---
package webwork.multipart.parser;
import java.io.InputStream;
import java.io.IOException;
/**
A Multipart form data parser. Parses an input stream and writes out any files found,
making available a hashtable of other url parameters. As of version 1.17 the files can
be saved to memory, and optionally written to a database, etc.
<BR>
<BR>
Copyright (c)2001-2003 Jason Pell.
<BR>
<PRE>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
<BR>
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
<BR>
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<BR>
Email: [email protected]
Url: http://www.geocities.com/jasonpell
</PRE>
A empty InputStream class for getFileContents() method.
*/
public class EmptyInputStream extends InputStream
{
public EmptyInputStream()
{
}
public int read() throws IOException
{
return -1;
}
public int available() throws IOException
{
return 0;
}
}
--- NEW FILE: MaxReadBytesException.java ---
package webwork.multipart.parser;
import java.io.IOException;
public class MaxReadBytesException extends IOException
{
long maxReadBytes;
long contentLength;
public MaxReadBytesException(long contentLength, long maxReadBytes)
{
super("Content length exceeded ("+contentLength+" > "+maxReadBytes+")");
this.maxReadBytes = maxReadBytes;
this.contentLength = contentLength;
}
public long getContentLength()
{
return this.contentLength;
}
public long getMaxReadBytes()
{
return this.maxReadBytes;
}
}
--- NEW FILE: MultipartListener.java ---
package webwork.multipart.parser;
/**
* @author Hani Suleiman
* Date: Dec 9, 2002
* Time: 1:58:55 PM
*/
public interface MultipartListener
{
void fileStarted(String fileName, long size);
void dataRead(String fileName, int amount);
void fileCompleted(String fileName);
}
--- NEW FILE: MultipartRequest.java ---
package webwork.multipart.parser;
import java.io.*;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* A Multipart form data parser. Parses an input stream and writes out any files found,
* making available a hashtable of other url parameters. As of version 1.17 the files can
* be saved to memory, and optionally written to a database, etc.
* <p/>
* <BR>
* <BR>
* Copyright (c)2001-2003 Jason Pell.
* <BR>
[...1065 lines suppressed...]
while((c = in.read()) != -1)
{
b[off++] = (byte)c;
count++;
if(c == '\n' || count == len)
break;
}
return count > 0 ? count : -1;
}
/**
* Use when debugging this object.
*/
protected void debug(String x)
{
log.debug(x);
}
}
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click