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:
readin classInputStream- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
Return an estimate of the number of bytes remaining in the byte stream.- Overrides:
availablein 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
- Overrides:
markin classInputStream- Parameters:
readlimit- max read limit (ignored)
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
- Overrides:
markSupportedin classInputStream
-