Package io.bytestreams.codec.core.util
Interface CodePointReader
public interface CodePointReader
Reads code points from an input stream using a charset.
Use create(InputStream, Charset) to obtain an implementation optimized for the
stream's capabilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CodePointReadercreate(InputStream input, Charset charset) Creates a code point reader optimized for the given input stream.read(int count) Reads the specified number of code points from the stream.
-
Method Details
-
create
Creates a code point reader optimized for the given input stream.If the stream supports mark/reset, returns a buffered implementation that reads ahead and resets on over-read. Otherwise, returns a byte-by-byte implementation.
- Parameters:
input- the input stream to read fromcharset- the charset to use for decoding- Returns:
- a code point reader
-
read
Reads the specified number of code points from the stream.- Parameters:
count- the number of code points to read (must be non-negative)- Returns:
- the string containing the code points, or empty string if count is 0
- Throws:
EOFException- if end of stream reached before reading the required code pointsIOException- if an I/O error occursIllegalArgumentException- if count is negative
-