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:
Closeable
,AutoCloseable
,Readable
- Direct Known Subclasses:
XMLStreamNormalizingReader
This class represents a NormalizingReader which handles streams of
bytes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
To create an ASCIIDecoder.protected static interface
Represents a CharDecoder factory.protected static class
To create an ISO_8859_1Decoder.protected static class
To create a UTF16Decoder.protected static class
To create a UTF8Decoder. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CharDecoder
The char decoder.protected static final Map
The CharDecoder factories map.protected int
The current column in the stream.protected int
The current line in the stream.protected int
The next char. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
This 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 TypeMethodDescriptionvoid
close()
Close the stream.protected CharDecoder
createCharDecoder
(InputStream is, String enc) Creates the CharDecoder mapped with the given encoding name.int
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, nullReader, read, read, 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:
read
in classReader
- Throws:
IOException
-
getLine
public int getLine()Returns the current line in the stream.- Specified by:
getLine
in classNormalizingReader
-
getColumn
public int getColumn()Returns the current column in the stream.- Specified by:
getColumn
in classNormalizingReader
-
close
Close the stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-
createCharDecoder
Creates the CharDecoder mapped with the given encoding name.- Throws:
IOException
-