Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.httpclient.methods.multipart
Class StringPart  view StringPart download StringPart.java

java.lang.Object
  extended byorg.apache.commons.httpclient.methods.multipart.Part
      extended byorg.apache.commons.httpclient.methods.multipart.PartBase
          extended byorg.apache.commons.httpclient.methods.multipart.StringPart

public class StringPart
extends PartBase

Simple string parameter for a multipart post

Since:
2.0

Field Summary
private  byte[] content
          Contents of this StringPart.
static java.lang.String DEFAULT_CHARSET
          Default charset of string parameters
static java.lang.String DEFAULT_CONTENT_TYPE
          Default content encoding of string parameters.
static java.lang.String DEFAULT_TRANSFER_ENCODING
          Default transfer encoding of string parameters
private static org.apache.commons.logging.Log LOG
          Log object for this class.
private  java.lang.String value
          The String value of this part.
 
Fields inherited from class org.apache.commons.httpclient.methods.multipart.PartBase
 
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(java.lang.String name, java.lang.String value)
          Constructor.
StringPart(java.lang.String name, java.lang.String value, java.lang.String charset)
          Constructor.
 
Method Summary
private  byte[] getContent()
          Gets the content in bytes.
protected  long lengthOfData()
          Return the length of the data.
protected  void sendData(java.io.OutputStream out)
          Writes the data to the given OutputStream.
 void setCharSet(java.lang.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, setPartBoundary, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.commons.logging.Log LOG
Log object for this class.


DEFAULT_CONTENT_TYPE

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

See Also:
Constant Field Values

DEFAULT_CHARSET

public static final java.lang.String DEFAULT_CHARSET
Default charset of string parameters

See Also:
Constant Field Values

DEFAULT_TRANSFER_ENCODING

public static final java.lang.String DEFAULT_TRANSFER_ENCODING
Default transfer encoding of string parameters

See Also:
Constant Field Values

content

private byte[] content
Contents of this StringPart.


value

private java.lang.String value
The String value of this part.

Constructor Detail

StringPart

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


StringPart

public StringPart(java.lang.String name,
                  java.lang.String value)
Constructor.

Method Detail

getContent

private byte[] getContent()
Gets the content in bytes. Bytes are lazily created to allow the charset to be changed after the part is created.


sendData

protected void sendData(java.io.OutputStream out)
                 throws java.io.IOException
Writes the data to the given OutputStream.

Specified by:
sendData in class Part

lengthOfData

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

Specified by:
lengthOfData in class Part

setCharSet

public void setCharSet(java.lang.String charSet)
Description copied from class: PartBase
Sets the character encoding.

Overrides:
setCharSet in class PartBase