com.tenduke.io
Class URLDecodeInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by com.tenduke.io.URLDecodeInputStream
All Implemented Interfaces:
java.io.Closeable

public class URLDecodeInputStream
extends java.io.FilterInputStream

Reads input stream and converts % hex hex to corresponding URL decoded char, and converts + to an empty space.


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
URLDecodeInputStream(java.io.InputStream in)
          Creates a new instance of URLDecodeInputStream.
 
Method Summary
 int read()
          Reads a byte from the stream.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLDecodeInputStream

public URLDecodeInputStream(java.io.InputStream in)
Creates a new instance of URLDecodeInputStream.

Parameters:
in -
Method Detail

read

public int read()
         throws java.io.IOException
Reads a byte from the stream. If read byte equals to '%' then it is assumed that a hex code follows, which is read and URL decoded. The corresponding character is then returned.

Overrides:
read in class java.io.FilterInputStream
Returns:
Next byte of data from this input stream, URL decoded.
Throws:
java.io.IOException - for any IO errors while reading from stream.