public class CharSequenceInputStream extends InputStream
InputStream
to read from String, StringBuffer, StringBuilder or CharBuffer.
Constructor and Description |
---|
CharSequenceInputStream(CharSequence cs,
Charset charset)
Constructs a new instance with a buffer size of
IOUtils.DEFAULT_BUFFER_SIZE . |
CharSequenceInputStream(CharSequence cs,
Charset charset,
int bufferSize)
Constructs a new instance.
|
CharSequenceInputStream(CharSequence cs,
String charset)
Constructs a new instance with a buffer size of
IOUtils.DEFAULT_BUFFER_SIZE . |
CharSequenceInputStream(CharSequence cs,
String charset,
int bufferSize)
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Return an estimate of the number of bytes remaining in the byte stream.
|
void |
close() |
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] array,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
public CharSequenceInputStream(CharSequence cs, Charset charset)
IOUtils.DEFAULT_BUFFER_SIZE
.cs
- the input character sequence.charset
- the character set name to use.IllegalArgumentException
- if the buffer is not large enough to hold a complete character.public CharSequenceInputStream(CharSequence cs, Charset charset, int bufferSize)
cs
- the input character sequence.charset
- the character set name to use, null maps to the default Charset.bufferSize
- the buffer size to use.IllegalArgumentException
- if the buffer is not large enough to hold a complete character.public CharSequenceInputStream(CharSequence cs, String charset)
IOUtils.DEFAULT_BUFFER_SIZE
.cs
- the input character sequence.charset
- the character set name to use.IllegalArgumentException
- if the buffer is not large enough to hold a complete character.public CharSequenceInputStream(CharSequence cs, String charset, int bufferSize)
cs
- the input character sequence.charset
- the character set name to use, null maps to the default Charset.bufferSize
- the buffer size to use.IllegalArgumentException
- if the buffer is not large enough to hold a complete character.public int available() throws IOException
available
in class InputStream
IOException
- if an error occurs (probably not possible).public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public void mark(int readlimit)
mark
in class InputStream
readlimit
- max read limit (ignored).public boolean markSupported()
markSupported
in class InputStream
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] array, int off, int len) throws IOException
read
in class InputStream
IOException
public void reset() throws IOException
reset
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.