public class StringPart extends PartBase
Simple string parameter for a multipart post
Since:
2.0
  • Field Details

    • DEFAULT_CONTENT_TYPE

      public static final String DEFAULT_CONTENT_TYPE
      Default content encoding of string parameters.
      See Also:
    • DEFAULT_CHARSET

      public static final String DEFAULT_CHARSET
      Default charset of string parameters
      See Also:
    • DEFAULT_TRANSFER_ENCODING

      public static final String DEFAULT_TRANSFER_ENCODING
      Default transfer encoding of string parameters
      See Also:
  • Constructor Details

    • 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 default is used
    • StringPart

      public StringPart(String name, String value)
      Constructor.
      Parameters:
      name - The name of the part
      value - the string to post
  • Method Details

    • sendData

      protected void sendData(OutputStream out) throws IOException
      Writes the data to the given OutputStream.
      Specified by:
      sendData in class Part
      Parameters:
      out - the OutputStream to write to
      Throws:
      IOException - if there is a write error
    • 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:
    • setCharSet

      public void setCharSet(String charSet)
      Description copied from class: PartBase
      Sets the character encoding.
      Overrides:
      setCharSet in class PartBase
      Parameters:
      charSet - the character encoding, or null to exclude the character encoding header