com.jkristian.io
Class FormEncodedOutput

java.lang.Object
  extended by com.jkristian.io.FormEncodedOutput

public class FormEncodedOutput
extends java.lang.Object

A collection of objects used for generating a application/x-www-form-urlencoded document.

This class is not thread-safe.


Constructor Summary
FormEncodedOutput(java.io.OutputStream raw, java.lang.String encoding)
          Deprecated. The preferred usage is new FormEncodedOutput(encoding, new BufferedOutputStream(raw, ...)).
FormEncodedOutput(java.lang.String encoding, java.io.OutputStream output)
          Set this.output = output; this.raw = null.
 
Method Summary
 void close()
          Close the streams that were instantiated by this object.
protected  void finalize()
           
 void flush()
           
 java.io.OutputStream getEncoderStream()
          Bytes written to this stream will be URL-encoded and then written to the output stream.
 java.io.Writer getEncoderWriter()
          Characters written to this stream will be encoded as bytes, which will be URL-encoded and then written to the output stream.
 java.lang.String getEncoding()
           
 java.io.OutputStream getOutput()
           
 java.io.OutputStream getRawOutput()
          Deprecated.  
 void writeParameter(java.lang.String name, java.lang.String value)
          Write a name/value pair in the format name=value.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormEncodedOutput

public FormEncodedOutput(java.lang.String encoding,
                         java.io.OutputStream output)
                  throws java.io.UnsupportedEncodingException
Set this.output = output; this.raw = null.

Throws:
java.io.UnsupportedEncodingException

FormEncodedOutput

public FormEncodedOutput(java.io.OutputStream raw,
                         java.lang.String encoding)
                  throws java.io.UnsupportedEncodingException
Deprecated. The preferred usage is new FormEncodedOutput(encoding, new BufferedOutputStream(raw, ...)).

Set this.output = new BufferedOutputStream(raw); this.raw = raw.

Throws:
java.io.UnsupportedEncodingException
Method Detail

getEncoding

public java.lang.String getEncoding()

getRawOutput

public final java.io.OutputStream getRawOutput()
Deprecated. 


getOutput

public final java.io.OutputStream getOutput()

getEncoderStream

public final java.io.OutputStream getEncoderStream()
Bytes written to this stream will be URL-encoded and then written to the output stream.


getEncoderWriter

public final java.io.Writer getEncoderWriter()
Characters written to this stream will be encoded as bytes, which will be URL-encoded and then written to the output stream.


flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
Close the streams that were instantiated by this object. But don't close the OutputStream that was passed to the constructor (in case you need to continue using it).


finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

writeParameter

public void writeParameter(java.lang.String name,
                           java.lang.String value)
                    throws java.io.IOException
Write a name/value pair in the format name=value. The name and value are each URL-encoded. Don't write an '&'. If name and/or value are null, do nothing.

Throws:
java.io.IOException