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
Implements an 
InputStream to read bytes from String, StringBuffer, StringBuilder or CharBuffer,
 encoded using the specified Charset. The Charset defaults to Charset.defaultCharset().
 
 Note: Supports mark(int) and reset().
 
 To build an instance, use CharSequenceInputStream.Builder.
 
- Since:
- 2.2
- See Also:
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructorsConstructorDescriptionCharSequenceInputStream(CharSequence cs, String charset) Deprecated.CharSequenceInputStream(CharSequence cs, String charset, int bufferSize) Deprecated.CharSequenceInputStream(CharSequence cs, Charset charset) Deprecated.CharSequenceInputStream(CharSequence cs, Charset charset, int bufferSize) Deprecated.
- 
Method SummaryModifier and TypeMethodDescriptionintGets a lower bound on the number of bytes remaining in the byte stream.builder()Constructs a newCharSequenceInputStream.Builder.voidclose()voidmark(int readLimit) booleanintread()intread(byte[] b) intread(byte[] array, int off, int len) voidreset()longskip(long n) 
- 
Constructor Details- 
CharSequenceInputStreamDeprecated.Constructs a new instance with a buffer size ofIOUtils.DEFAULT_BUFFER_SIZE.- Parameters:
- cs- the input character sequence.
- charset- the character set name to use.
- Throws:
- IllegalArgumentException- if the buffer is not large enough to hold a complete character.
 
- 
CharSequenceInputStreamDeprecated.Constructs a new instance.- Parameters:
- cs- the input character sequence.
- charset- the character set name to use, null maps to the default Charset.
- bufferSize- the buffer size to use.
- Throws:
- IllegalArgumentException- if the buffer is not large enough to hold a complete character.
 
- 
CharSequenceInputStreamDeprecated.Constructs a new instance with a buffer size ofIOUtils.DEFAULT_BUFFER_SIZE.- Parameters:
- cs- the input character sequence.
- charset- the character set name to use.
- Throws:
- IllegalArgumentException- if the buffer is not large enough to hold a complete character.
 
- 
CharSequenceInputStreamDeprecated.Constructs a new instance.- Parameters:
- cs- the input character sequence.
- charset- the character set name to use, null maps to the default Charset.
- bufferSize- the buffer size to use.
- Throws:
- IllegalArgumentException- if the buffer is not large enough to hold a complete character.
 
 
- 
- 
Method Details- 
builderConstructs a newCharSequenceInputStream.Builder.- Returns:
- a new CharSequenceInputStream.Builder.
- Since:
- 2.12.0
 
- 
availableGets a lower bound on the number of bytes remaining in the byte stream.- Overrides:
- availablein class- InputStream
- 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 interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- InputStream
- Throws:
- IOException
 
- 
mark- Overrides:
- markin class- InputStream
- Parameters:
- readLimit- max read limit (ignored).
 
- 
markSupported- Overrides:
- markSupportedin class- InputStream
 
- 
read- Specified by:
- readin class- InputStream
- Throws:
- IOException
 
- 
read- Overrides:
- readin class- InputStream
- Throws:
- IOException
 
- 
read- Overrides:
- readin class- InputStream
- Throws:
- IOException
 
- 
reset- Overrides:
- resetin class- InputStream
- Throws:
- IOException
 
- 
skip- Overrides:
- skipin class- InputStream
- Throws:
- IOException
 
 
- 
builder(),CharSequenceInputStream.Builder, andCharSequenceInputStream.Builder.get()