com.jkristian.io
Class FilteredCharInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.jkristian.io.FilteredByteInputStream
          extended by com.jkristian.io.FilteredCharInputStream
All Implemented Interfaces:
java.io.Closeable
Direct Known Subclasses:
StringFilterInputStream

public abstract class FilteredCharInputStream
extends FilteredByteInputStream

A stream that produces input by reading from an underlying source, optionally transforming the data through a chain of FilterWriters, encoding it as bytes and optionally transforming them through a chain of FilterOutputStreams.

This class is not thread-safe.


Field Summary
 
Fields inherited from class com.jkristian.io.FilteredByteInputStream
CHUNK_LENGTH
 
Constructor Summary
FilteredCharInputStream()
          Create a filter that encodes characters using the default encoding.
FilteredCharInputStream(java.lang.String encoding)
          Create a filter that encodes characters using the named encoding.
 
Method Summary
 void close()
           
protected  void flush()
          Flush the filters into the output.
 java.io.OutputStream getByteFilter()
           
 java.io.Writer getCharFilter()
           
 void setByteFilter(java.io.OutputStream filter)
          Set the tail of the chain of FilterOutputStreams.
 void setCharFilter(java.io.Writer filter)
          Set the tail of the chain of FilterWriters.
 
Methods inherited from class com.jkristian.io.FilteredByteInputStream
available, filterInput, mark, markSupported, read, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteredCharInputStream

public FilteredCharInputStream()
Create a filter that encodes characters using the default encoding.


FilteredCharInputStream

public FilteredCharInputStream(java.lang.String encoding)
                        throws java.io.UnsupportedEncodingException
Create a filter that encodes characters using the named encoding.

Parameters:
encoding - the name of a supported character encoding
Throws:
java.io.UnsupportedEncodingException
Method Detail

getByteFilter

public java.io.OutputStream getByteFilter()
Overrides:
getByteFilter in class FilteredByteInputStream
Returns:
a reference to the tail of the chain of FilterOutputStreams.

setByteFilter

public void setByteFilter(java.io.OutputStream filter)
Set the tail of the chain of FilterOutputStreams. Recommended usage is: setByteFilter(new YourFilterClass(getByteFilter()));

Overrides:
setByteFilter in class FilteredByteInputStream

getCharFilter

public java.io.Writer getCharFilter()
Returns:
a reference to the tail of the chain of FilterWriters.

setCharFilter

public void setCharFilter(java.io.Writer filter)
Set the tail of the chain of FilterWriters. Recommended usage is: setCharFilter(new YourFilterClass(getCharFilter()));


close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class FilteredByteInputStream
Throws:
java.io.IOException

flush

protected void flush()
              throws java.io.IOException
Flush the filters into the output.

Overrides:
flush in class FilteredByteInputStream
Throws:
java.io.IOException