|
The Encog Project | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.encog.bot.html.FormUtility
public class FormUtility
The Heaton Research Spider Copyright 2007 by Heaton Research, Inc. HTTP Programming Recipes for Java ISBN: 0-9773206-6-9 http://www.heatonresearch.com/articles/series/16/ FormUtility: This class is used to construct responses to HTML forms. The class supports both standard HTML forms, as well as multipart forms. This class is released under the: GNU Lesser General Public License (LGPL) http://www.gnu.org/copyleft/lesser.html
| Field Summary | |
|---|---|
static int |
BUFFER_SIZE
The size of the read buffer. |
static java.lang.String |
ENCODE
The charset to use for URL encoding. |
static int |
RANDOM_LENGTH
The length of random string to create for multipart. |
| Constructor Summary | |
|---|---|
FormUtility(java.io.OutputStream os,
java.lang.String boundary)
Prepare to access either a regular, or multipart, form. |
|
| Method Summary | |
|---|---|
void |
add(java.lang.String name,
java.io.File file)
Add a file to a multipart form. |
void |
add(java.lang.String name,
java.lang.String value)
Add a regular text field to either a regular or multipart form. |
void |
complete()
Complete the building of the form. |
static java.lang.String |
getBoundary()
Generate a boundary for a multipart form. |
static java.util.Map<java.lang.String,java.lang.String> |
parse(java.lang.String form)
Parse a URL query string. |
protected static java.lang.String |
randomString()
Generate a random string, of a specified length. |
protected void |
writeln(java.lang.String str)
Write a string, with a carriage return and linefeed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String ENCODE
public static final int BUFFER_SIZE
public static final int RANDOM_LENGTH
| Constructor Detail |
|---|
public FormUtility(java.io.OutputStream os,
java.lang.String boundary)
os - The stream to output to.boundary - The boundary to be used, or null if this is not a multipart
form.| Method Detail |
|---|
public static java.lang.String getBoundary()
public static java.util.Map<java.lang.String,java.lang.String> parse(java.lang.String form)
form - The query string to parse.
protected static java.lang.String randomString()
public void add(java.lang.String name,
java.io.File file)
throws java.io.IOException
name - The field name.file - The file to attach.
java.io.IOException - If any error occurs while writing.
public void add(java.lang.String name,
java.lang.String value)
throws java.io.IOException
name - The name of the field.value - The value of the field.
java.io.IOException - If any error occurs while writing.
public void complete()
throws java.io.IOException
java.io.IOException - If any error occurs while writing.
protected void writeln(java.lang.String str)
throws java.io.IOException
str - The string to write.
java.io.IOException - If any error occurs while writing.
|
The Encog Project | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||