public class DynamicReader extends Reader
| Constructor and Description |
|---|
DynamicReader(InputStream inputStream)
Construct a
DynamicReader for the supplied InputStream. |
DynamicReader(InputStream inputStream,
Charset charset)
Construct a
DynamicReader for the supplied InputStream, switching immediately to the specified
Charset if specified. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
read(char[] cbuf,
int off,
int len)
Reads characters into a portion of an array.
|
void |
switchTo(Charset charset)
Switch to the nominated character set.
|
void |
switchTo(IntAcceptor<? extends Void> delegate)
Switch to the specified delegate.
|
void |
switchTo(String charsetName)
Switch to the nominated character set.
|
public DynamicReader(InputStream inputStream)
DynamicReader for the supplied InputStream.inputStream - the InputStreampublic DynamicReader(InputStream inputStream, Charset charset)
DynamicReader for the supplied InputStream, switching immediately to the specified
Charset if specified. This bypasses much of the functionality of the DynamicDecoder, but
allowing the Charset to be specified in this way simplifies the creation of a DynamicReader in
those cases where the encoding may be, but is not always, known in advance.inputStream - the InputStreamcharset - the Charset if known, or null to allow dynamic encoding determinationpublic int read(char[] cbuf,
int off,
int len)
throws IOException
read in class Readercbuf - Destination bufferoff - Offset at which to start storing characterslen - Maximum number of characters to readIOException - If an I/O error occurspublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class ReaderIOExceptionpublic void switchTo(IntAcceptor<? extends Void> delegate)
delegate - the new delegatepublic void switchTo(Charset charset)
charset - the Charsetpublic void switchTo(String charsetName)
charsetName - the character set nameCopyright © 2025. All rights reserved.