org.apache.batik.util.io
Class StreamNormalizingReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--org.apache.batik.util.io.NormalizingReader
              |
              +--org.apache.batik.util.io.StreamNormalizingReader
Direct Known Subclasses:
XMLStreamNormalizingReader

public class StreamNormalizingReader
extends NormalizingReader

This class represents a NormalizingReader which handles streams of bytes.


Inner Class Summary
protected static class StreamNormalizingReader.ASCIIDecoderFactory
          To create an ASCIIDecoder.
protected static interface StreamNormalizingReader.CharDecoderFactory
          Represents a CharDecoder factory.
protected static class StreamNormalizingReader.ISO_8859_1DecoderFactory
          To create an ISO_8859_1Decoder.
protected static class StreamNormalizingReader.UTF16DecoderFactory
          To create a UTF16Decoder.
protected static class StreamNormalizingReader.UTF8DecoderFactory
          To create a UTF8Decoder.
 
Field Summary
protected  CharDecoder charDecoder
          The char decoder.
protected static java.util.Map charDecoderFactories
          The CharDecoder factories map.
protected  int column
          The current column in the stream.
protected  int line
          The current line in the stream.
protected  int nextChar
          The next char.
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
protected StreamNormalizingReader()
          This constructor is intended for use by subclasses.
  StreamNormalizingReader(java.io.InputStream is)
          Creates a new NormalizingReader.
  StreamNormalizingReader(java.io.InputStream is, java.lang.String enc)
          Creates a new NormalizingReader.
  StreamNormalizingReader(java.io.Reader r)
          Creates a new NormalizingReader.
 
Method Summary
 void close()
          Close the stream.
protected  CharDecoder createCharDecoder(java.io.InputStream is, java.lang.String enc)
          Creates the CharDecoder mapped with the given encoding name.
 int getColumn()
          Returns the current column in the stream.
 int getLine()
          Returns the current line in the stream.
 int read()
          Read a single character.
 
Methods inherited from class org.apache.batik.util.io.NormalizingReader
read
 
Methods inherited from class java.io.Reader
mark, markSupported, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

charDecoder

protected CharDecoder charDecoder
The char decoder.

nextChar

protected int nextChar
The next char.

line

protected int line
The current line in the stream.

column

protected int column
The current column in the stream.

charDecoderFactories

protected static final java.util.Map charDecoderFactories
The CharDecoder factories map.
Constructor Detail

StreamNormalizingReader

public StreamNormalizingReader(java.io.InputStream is)
                        throws java.io.IOException
Creates a new NormalizingReader. The encoding is assumed to be ISO-8859-1.
Parameters:
is - The input stream to decode.

StreamNormalizingReader

public StreamNormalizingReader(java.io.InputStream is,
                               java.lang.String enc)
                        throws java.io.IOException
Creates a new NormalizingReader.
Parameters:
is - The input stream to decode.
enc - The standard encoding name. A null encoding means ISO-8859-1.

StreamNormalizingReader

public StreamNormalizingReader(java.io.Reader r)
                        throws java.io.IOException
Creates a new NormalizingReader.
Parameters:
r - The reader to wrap.

StreamNormalizingReader

protected StreamNormalizingReader()
This constructor is intended for use by subclasses.
Method Detail

read

public int read()
         throws java.io.IOException
Read a single character. This method will block until a character is available, an I/O error occurs, or the end of the stream is reached.
Overrides:
read in class java.io.Reader

getLine

public int getLine()
Returns the current line in the stream.
Overrides:
getLine in class NormalizingReader

getColumn

public int getColumn()
Returns the current column in the stream.
Overrides:
getColumn in class NormalizingReader

close

public void close()
           throws java.io.IOException
Close the stream.
Overrides:
close in class java.io.Reader

createCharDecoder

protected CharDecoder createCharDecoder(java.io.InputStream is,
                                        java.lang.String enc)
                                 throws java.io.IOException
Creates the CharDecoder mapped with the given encoding name.


Copyright © 2002 Apache Software Foundation. All Rights Reserved.