R - the "Result" class (may be Void)public class SwitchableDecoder<R> extends AbstractIntPipeline<R>
An XML file declares its encoding on the prefix line, and an HTML file can contain a META tag specifying the content type and encoding of the data. These rely on the declaration occurring early in the file, before any characters outside the base ASCII set are expected to be encountered.
This decoder allows the reading of an input stream to commence in ASCII decoding, switching to the full decoding once the declaration has been read.
| Modifier and Type | Field and Description |
|---|---|
protected IntAcceptor<? extends R> |
delegate |
| Constructor and Description |
|---|
SwitchableDecoder(IntAcceptor<? extends R> downstream)
Construct a
SwitchableDecoder with the given downstream IntAcceptor. |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptInt(int value)
Accept a character, after
closed check and test for end of data. |
boolean |
isStageComplete()
Return
true if all sequences in the input to this stage of the pipeline are complete, that is, the input
is not in the middle of a sequence requiring more data. |
void |
switchTo(Charset charset)
Switch to the nominated character set.
|
void |
switchTo(IntAcceptor<? extends R> delegate)
Switch to the specified delegate.
|
void |
switchTo(String charsetName)
Switch to the nominated character set.
|
close, emit, flush, getDownstreamaccept, acceptisClosedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaccept, accept, accept, accept, accept, accept, accept, accept, accept, acceptandThengetResult, isCompleteisClosed, safeCloseprotected IntAcceptor<? extends R> delegate
public SwitchableDecoder(IntAcceptor<? extends R> downstream)
SwitchableDecoder with the given downstream IntAcceptor.downstream - the IntAcceptorpublic void acceptInt(int value)
closed check and test for end of data. Forward the character to the delegate
if present, otherwise emit it directly (with no conversion).acceptInt in class AbstractIntAcceptor<R>value - the input valuepublic boolean isStageComplete()
true if all sequences in the input to this stage of the pipeline are complete, that is, the input
is not in the middle of a sequence requiring more data.true if the input is in the "complete" statepublic void switchTo(IntAcceptor<? extends R> 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.