org.encog.util.http
public class FormUtility extends Object
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE
The size of the read buffer.
|
static String |
ENCODE
The charset to use for URL encoding.
|
static int |
RANDOM_LENGTH
The length of random string to create for multipart.
|
Constructor and Description |
---|
FormUtility(OutputStream os,
String boundary)
Prepare to access either a regular, or multipart, form.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
File file)
Add a file to a multipart form.
|
void |
add(String name,
String value)
Add a regular text field to either a regular or multipart form.
|
void |
complete()
Complete the building of the form.
|
static String |
getBoundary()
Generate a boundary for a multipart form.
|
static Map<String,String> |
parse(String form)
Parse a URL query string.
|
protected static String |
randomString()
Generate a random string, of a specified length.
|
protected void |
writeln(String str)
Write a string, with a carriage return and linefeed.
|
public static final String ENCODE
public static final int BUFFER_SIZE
public static final int RANDOM_LENGTH
public FormUtility(OutputStream os, String boundary)
os
- The stream to output to.boundary
- The boundary to be used, or null if this is not a multipart
form.public static String getBoundary()
public static Map<String,String> parse(String form)
form
- The query string to parse.protected static String randomString()
public void add(String name, File file)
name
- The field name.file
- The file to attach.public void add(String name, String value)
name
- The name of the field.value
- The value of the field.public void complete()
protected void writeln(String str)
str
- The string to write.Copyright © 2014. All Rights Reserved.