Package org.apache.commons.io.input
Class CharSequenceInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.io.input.CharSequenceInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
InputStream
implementation that can read from String, StringBuffer,
StringBuilder or CharBuffer.
- Since:
- 2.2
-
Constructor Summary
ConstructorsConstructorDescriptionCharSequenceInputStream
(CharSequence cs, String charset) Constructor, callsCharSequenceInputStream(CharSequence, String, int)
with a buffer size of 2048.CharSequenceInputStream
(CharSequence cs, String charset, int bufferSize) Constructor, callsCharSequenceInputStream(CharSequence, Charset, int)
.CharSequenceInputStream
(CharSequence cs, Charset charset) Constructor, callsCharSequenceInputStream(CharSequence, Charset, int)
with a buffer size of 2048.CharSequenceInputStream
(CharSequence cs, Charset charset, int bufferSize) Constructor. -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
CharSequenceInputStream
Constructor.- Parameters:
cs
- the input character sequencecharset
- the character set name to usebufferSize
- the buffer size to use.- Throws:
IllegalArgumentException
- if the buffer is not large enough to hold a complete character
-
CharSequenceInputStream
Constructor, callsCharSequenceInputStream(CharSequence, Charset, int)
.- Parameters:
cs
- the input character sequencecharset
- the character set name to usebufferSize
- the buffer size to use.- Throws:
IllegalArgumentException
- if the buffer is not large enough to hold a complete character
-
CharSequenceInputStream
Constructor, callsCharSequenceInputStream(CharSequence, Charset, int)
with a buffer size of 2048.- Parameters:
cs
- the input character sequencecharset
- the character set name to use- Throws:
IllegalArgumentException
- if the buffer is not large enough to hold a complete character
-
CharSequenceInputStream
Constructor, callsCharSequenceInputStream(CharSequence, String, int)
with a buffer size of 2048.- Parameters:
cs
- the input character sequencecharset
- the character set name to use- Throws:
IllegalArgumentException
- if the buffer is not large enough to hold a complete character
-
-
Method Details
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
available
Return an estimate of the number of bytes remaining in the byte stream.- Overrides:
available
in classInputStream
- Returns:
- the count of bytes that can be read without blocking (or returning EOF).
- Throws:
IOException
- if an error occurs (probably not possible)
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
mark
- Overrides:
mark
in classInputStream
- Parameters:
readlimit
- max read limit (ignored)
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
- Overrides:
markSupported
in classInputStream
-