org.apache.commons.httpclient.methods.multipart
Class StringPart

java.lang.Object
  |
  +--org.apache.commons.httpclient.methods.multipart.Part
        |
        +--org.apache.commons.httpclient.methods.multipart.StringPart

public class StringPart
extends Part

Simple string parameter for a multipart post

Since:
2.0
Author:
Matthew Albright, Jeff Dever, Mike Bowler, Oleg Kalnichevski

Field Summary
static String DEFAULT_CHARSET
          Default charset of string parameters
static String DEFAULT_CONTENT_TYPE
          Default content encoding of string parameters.
static String DEFAULT_TRANSFER_ENCODING
          Default 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
StringPart(String name, String value)
          Constructor.
StringPart(String name, String value, String charset)
          Constructor.
 
Method Summary
 String getCharSet()
          Return the character encoding of this part.
 String getContentType()
          Return the content type of this part.
 String getName()
          Return the name of this part.
 String getTransferEncoding()
          Return the transfer encoding of this part.
protected  long lengthOfData()
          Return the length of the data.
protected  void sendData(OutputStream out)
          Write the data to the specified output stream
 
Methods inherited from class org.apache.commons.httpclient.methods.multipart.Part
getBoundary, getLengthOfParts, length, send, sendContentTypeHeader, sendDispositionHeader, sendEnd, sendEndOfHeader, sendParts, sendStart, sendTransferEncodingHeader, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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
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

StringPart

public StringPart(String name,
                  String value)
Constructor.

Parameters:
name - The name of the part
value - the string to post
Method Detail

getName

public String getName()
Return the name of this part.

Specified by:
getName in class Part
Returns:
the name of this StringPart.

getContentType

public String getContentType()
Return the content type of this part.

Specified by:
getContentType in class Part
Returns:
String The name.

getCharSet

public String getCharSet()
Return the character encoding of this part.

Specified by:
getCharSet in class Part
Returns:
String The name.

getTransferEncoding

public String getTransferEncoding()
Return the transfer encoding of this part.

Specified by:
getTransferEncoding in class Part
Returns:
String The name.

sendData

protected void sendData(OutputStream out)
                 throws IOException
Description copied from class: Part
Write the data to the specified output stream

Specified by:
sendData in class Part
Parameters:
out - The output stream
Throws:
IOException - If an IO problem occurs.

lengthOfData

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

Specified by:
lengthOfData in class Part
Returns:
The length of the data.
Throws:
IOException - If an IO problem occurs
See Also:
Part.lengthOfData()


Copyright (c) 1999-2002 - Apache Software Foundation