public final class AsciiInputStream extends InputStream
AsciiInputStream
will throw an IOException
.
This can be used in code that expects an input stream where a reader is available.
One such example is base64 decoding. Even though base64 is text, Base64.Decoder
can only wrap InputStream
. This method can help:
InputStream input = Base64.getDecoder().wrap(new AsciiInputStream(reader));
When an AsciiInputStream
is closed, the wrapped reader will be closed as well.
Constructor and Description |
---|
AsciiInputStream(Reader input)
Creates a new ASCII input stream.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
mark, markSupported, read, reset, skip
public AsciiInputStream(Reader input)
input
- The reader to wrap.NullPointerException
- If the given reader is null
.public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2020–2024. All rights reserved.