org.apache.commons.httpclient.methods.multipart

Class StringPart

public class StringPart extends PartBase

Simple string parameter for a multipart post

Since: 2.0

Author: Matthew Albright Jeff Dever Mike Bowler Oleg Kalnichevski

Field Summary
static StringDEFAULT_CHARSET
Default charset of string parameters
static StringDEFAULT_CONTENT_TYPE
Default content encoding of string parameters.
static StringDEFAULT_TRANSFER_ENCODING
Default transfer encoding of string parameters
Constructor Summary
StringPart(String name, String value, String charset)
Constructor.
StringPart(String name, String value)
Constructor.
Method Summary
protected longlengthOfData()
Return the length of the data.
protected voidsendData(OutputStream out)
Writes the data to the given OutputStream.
voidsetCharSet(String charSet)

Field Detail

DEFAULT_CHARSET

public static final String DEFAULT_CHARSET
Default charset of string parameters

DEFAULT_CONTENT_TYPE

public static final String DEFAULT_CONTENT_TYPE
Default content encoding of string parameters.

DEFAULT_TRANSFER_ENCODING

public static final String DEFAULT_TRANSFER_ENCODING
Default transfer encoding of string parameters

Constructor Detail

StringPart

public StringPart(String name, String value, String charset)
Constructor.

Parameters: name The name of the part value the string to post charset the charset to be used to encode the string, if null the {@link #DEFAULT_CHARSET default} is used

StringPart

public StringPart(String name, String value)
Constructor.

Parameters: name The name of the part value the string to post

Method Detail

lengthOfData

protected long lengthOfData()
Return the length of the data.

Returns: The length of the data.

Throws: IOException If an IO problem occurs

See Also: lengthOfData

sendData

protected void sendData(OutputStream out)
Writes the data to the given OutputStream.

Parameters: out the OutputStream to write to

Throws: IOException if there is a write error

setCharSet

public void setCharSet(String charSet)
Copyright (c) 1999-2005 - Apache Software Foundation