Class StringPart
- java.lang.Object
-
- org.apache.commons.httpclient.methods.multipart.Part
-
- org.apache.commons.httpclient.methods.multipart.PartBase
-
- org.apache.commons.httpclient.methods.multipart.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
Fields Modifier and Type Field Description static StringDEFAULT_CHARSETDefault charset of string parametersstatic StringDEFAULT_CONTENT_TYPEDefault content encoding of string parameters.static StringDEFAULT_TRANSFER_ENCODINGDefault transfer encoding of string parameters-
Fields inherited from class org.apache.commons.httpclient.methods.multipart.Part
BOUNDARY, BOUNDARY_BYTES, CHARSET, CHARSET_BYTES, CONTENT_DISPOSITION, CONTENT_DISPOSITION_BYTES, CONTENT_TRANSFER_ENCODING, CONTENT_TRANSFER_ENCODING_BYTES, CONTENT_TYPE, CONTENT_TYPE_BYTES, CRLF, CRLF_BYTES, EXTRA, EXTRA_BYTES, QUOTE, QUOTE_BYTES
-
-
Constructor Summary
Constructors Constructor Description StringPart(String name, String value)Constructor.StringPart(String name, String value, String charset)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longlengthOfData()Return the length of the data.protected voidsendData(OutputStream out)Writes the data to the given OutputStream.voidsetCharSet(String charSet)Sets the character encoding.-
Methods inherited from class org.apache.commons.httpclient.methods.multipart.PartBase
getCharSet, getContentType, getName, getTransferEncoding, setContentType, setName, setTransferEncoding
-
Methods inherited from class org.apache.commons.httpclient.methods.multipart.Part
getBoundary, getLengthOfParts, getLengthOfParts, getPartBoundary, isRepeatable, length, send, sendContentTypeHeader, sendDispositionHeader, sendEnd, sendEndOfHeader, sendParts, sendParts, sendStart, sendTransferEncodingHeader, toString
-
-
-
-
Field Detail
-
DEFAULT_CONTENT_TYPE
public static final String DEFAULT_CONTENT_TYPE
Default content encoding of string parameters.- See Also:
- Constant Field Values
-
DEFAULT_CHARSET
public static final String DEFAULT_CHARSET
Default charset of string parameters- See Also:
- Constant Field Values
-
DEFAULT_TRANSFER_ENCODING
public static final String DEFAULT_TRANSFER_ENCODING
Default transfer encoding of string parameters- See Also:
- Constant Field Values
-
-
Method Detail
-
sendData
protected void sendData(OutputStream out) throws IOException
Writes the data to the given OutputStream.- Specified by:
sendDatain classPart- Parameters:
out- the OutputStream to write to- Throws:
IOException- if there is a write error
-
lengthOfData
protected long lengthOfData() throws IOExceptionReturn the length of the data.- Specified by:
lengthOfDatain classPart- Returns:
- The length of the data.
- Throws:
IOException- If an IO problem occurs- See Also:
Part.lengthOfData()
-
setCharSet
public void setCharSet(String charSet)
Description copied from class:PartBaseSets the character encoding.- Overrides:
setCharSetin classPartBase- Parameters:
charSet- the character encoding, ornullto exclude the character encoding header
-
-