Package com.ibatis.common.io
Class ReaderInputStream
java.lang.Object
java.io.InputStream
com.ibatis.common.io.ReaderInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
An InputStream backed by a Reader.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]
The buffer.protected ByteArrayOutputStream
The byte array out.protected char[]
The chars.protected int
The length.protected int
The length.protected Reader
The reader.protected Writer
The writer. -
Constructor Summary
ConstructorsConstructorDescriptionReaderInputStream
(Reader reader) Constructor to supply a Reader.ReaderInputStream
(Reader reader, String encoding) Constructor to supply a Reader and an encoding. -
Method Summary
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
-
Field Details
-
reader
The reader. -
byteArrayOut
The byte array out. -
writer
The writer. -
chars
protected char[] charsThe chars. -
buffer
protected byte[] bufferThe buffer. -
index
protected int indexThe length. -
length
protected int lengthThe length.
-
-
Constructor Details
-
ReaderInputStream
Constructor to supply a Reader.- Parameters:
reader
- - the Reader used by the InputStream
-
ReaderInputStream
Constructor to supply a Reader and an encoding.- Parameters:
reader
- - the Reader used by the InputStreamencoding
- - the encoding to use for the InputStream- Throws:
UnsupportedEncodingException
- if the encoding is not supported
-
-
Method Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
- See Also:
-
fillBuffer
Fill buffer.- Throws:
IOException
- Signals that an I/O exception has occurred.
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
- See Also:
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
- See Also:
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
- See Also:
-