Package net.i2p.sam
Class UTF8Reader
java.lang.Object
java.io.Reader
net.i2p.sam.UTF8Reader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
An unbuffered version of InputStreamReader.
Does not read any extra characters, as long as input is well-formed.
This permits the partial reading of an InputStream as UTF-8
and then passing the remainder of the input stream elsewhere.
This isn't the most robust for malformed input, so it
may not be appropriate for e.g. HTTP headers.
Not thread-safe, obviously.
May be moved to net.i2p.util if anybody else needs it.
- Since:
- 0.9.24 somewhat adapted from net.i2p.util.TranslateReader
-
Field Summary
-
Constructor Summary
-
Method Summary
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, ready, reset, skip, transferTo
-
Constructor Details
-
UTF8Reader
- Parameters:
in
- UTF-8
-
-
Method Details
-
read
- Overrides:
read
in classReader
- Returns:
- replacement character on decoding error
- Throws:
IOException
-
read
- Overrides:
read
in classReader
- Throws:
IOException
-
read
- Specified by:
read
in classReader
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-