Package 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
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Readable
- Direct Known Subclasses:
XMLStreamNormalizingReader
public class StreamNormalizingReader extends NormalizingReader
This class represents a NormalizingReader which handles streams of bytes.- Version:
- $Id: StreamNormalizingReader.java 1733416 2016-03-03 07:07:13Z gadams $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classStreamNormalizingReader.ASCIIDecoderFactoryTo create an ASCIIDecoder.protected static interfaceStreamNormalizingReader.CharDecoderFactoryRepresents a CharDecoder factory.protected static classStreamNormalizingReader.ISO_8859_1DecoderFactoryTo create an ISO_8859_1Decoder.protected static classStreamNormalizingReader.UTF16DecoderFactoryTo create a UTF16Decoder.protected static classStreamNormalizingReader.UTF8DecoderFactoryTo create a UTF8Decoder.
-
Field Summary
Fields Modifier and Type Field Description protected CharDecodercharDecoderThe char decoder.protected static java.util.MapcharDecoderFactoriesThe CharDecoder factories map.protected intcolumnThe current column in the stream.protected intlineThe current line in the stream.protected intnextCharThe next char.
-
Constructor Summary
Constructors Modifier Constructor Description protectedStreamNormalizingReader()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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the stream.protected CharDecodercreateCharDecoder(java.io.InputStream is, java.lang.String enc)Creates the CharDecoder mapped with the given encoding name.intgetColumn()Returns the current column in the stream.intgetLine()Returns the current line in the stream.intread()Read a single character.-
Methods inherited from class org.apache.batik.util.io.NormalizingReader
read
-
-
-
-
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.IOExceptionCreates a new NormalizingReader. The encoding is assumed to be ISO-8859-1.- Parameters:
is- The input stream to decode.- Throws:
java.io.IOException
-
StreamNormalizingReader
public StreamNormalizingReader(java.io.InputStream is, java.lang.String enc) throws java.io.IOExceptionCreates a new NormalizingReader.- Parameters:
is- The input stream to decode.enc- The standard encoding name. A null encoding means ISO-8859-1.- Throws:
java.io.IOException
-
StreamNormalizingReader
public StreamNormalizingReader(java.io.Reader r) throws java.io.IOExceptionCreates a new NormalizingReader.- Parameters:
r- The reader to wrap.- Throws:
java.io.IOException
-
StreamNormalizingReader
protected StreamNormalizingReader()
This constructor is intended for use by subclasses.
-
-
Method Detail
-
read
public int read() throws java.io.IOExceptionRead 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:
readin classjava.io.Reader- Throws:
java.io.IOException
-
getLine
public int getLine()
Returns the current line in the stream.- Specified by:
getLinein classNormalizingReader
-
getColumn
public int getColumn()
Returns the current column in the stream.- Specified by:
getColumnin classNormalizingReader
-
close
public void close() throws java.io.IOExceptionClose the stream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Reader- Throws:
java.io.IOException
-
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.- Throws:
java.io.IOException
-
-