Class StreamNormalizingReader
java.lang.Object
java.io.Reader
org.apache.batik.util.io.NormalizingReader
org.apache.batik.util.io.StreamNormalizingReader
- All Implemented Interfaces:
Closeable, AutoCloseable, Readable
- Direct Known Subclasses:
XMLStreamNormalizingReader
This class represents a NormalizingReader which handles streams of
bytes.
- Version:
- $Id$
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classTo create an ASCIIDecoder.protected static interfaceRepresents a CharDecoder factory.protected static classTo create an ISO_8859_1Decoder.protected static classTo create a UTF16Decoder.protected static classTo create a UTF8Decoder. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CharDecoderThe char decoder.protected static final MapThe CharDecoder factories map.protected intThe current column in the stream.protected intThe current line in the stream.protected intThe next char. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThis constructor is intended for use by subclasses.Creates a new NormalizingReader.StreamNormalizingReader(InputStream is, String enc) Creates a new NormalizingReader.Creates a new NormalizingReader. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the stream.protected CharDecodercreateCharDecoder(InputStream is, String enc) Creates the CharDecoder mapped with the given encoding name.intReturns the current column in the stream.intgetLine()Returns the current line in the stream.intread()Read a single character.Methods inherited from class NormalizingReader
readMethods inherited from class Reader
mark, markSupported, nullReader, of, read, read, readAllAsString, readAllLines, ready, reset, skip, transferTo
-
Field Details
-
charDecoder
The char decoder. -
nextChar
protected int nextCharThe next char. -
line
protected int lineThe current line in the stream. -
column
protected int columnThe current column in the stream. -
charDecoderFactories
The CharDecoder factories map.
-
-
Constructor Details
-
StreamNormalizingReader
Creates a new NormalizingReader. The encoding is assumed to be ISO-8859-1.- Parameters:
is- The input stream to decode.- Throws:
IOException
-
StreamNormalizingReader
Creates a new NormalizingReader.- Parameters:
is- The input stream to decode.enc- The standard encoding name. A null encoding means ISO-8859-1.- Throws:
IOException
-
StreamNormalizingReader
Creates a new NormalizingReader.- Parameters:
r- The reader to wrap.- Throws:
IOException
-
StreamNormalizingReader
protected StreamNormalizingReader()This constructor is intended for use by subclasses.
-
-
Method Details
-
read
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:
readin classReader- Throws:
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
Close the stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-
createCharDecoder
Creates the CharDecoder mapped with the given encoding name.- Throws:
IOException
-