com.ibatis.common.io

Class ReaderInputStream

public class ReaderInputStream extends InputStream

An InputStream backed by a Reader
Field Summary
protected byte[]buffer
protected ByteArrayOutputStreambyteArrayOut
protected char[]chars
protected intindex
protected intlength
protected Readerreader
protected Writerwriter
Constructor Summary
ReaderInputStream(Reader reader)
Constructor to supply a Reader
ReaderInputStream(Reader reader, String encoding)
Constructor to supply a Reader and an encoding
Method Summary
intavailable()
voidclose()
protected voidfillBuffer()
intread()
intread(byte[] data, int off, int len)

Field Detail

buffer

protected byte[] buffer

byteArrayOut

protected ByteArrayOutputStream byteArrayOut

chars

protected char[] chars

index

protected int index

length

protected int length

reader

protected Reader reader

writer

protected Writer writer

Constructor Detail

ReaderInputStream

public ReaderInputStream(Reader reader)
Constructor to supply a Reader

Parameters: reader - the Reader used by the InputStream

ReaderInputStream

public ReaderInputStream(Reader reader, String encoding)
Constructor to supply a Reader and an encoding

Parameters: reader - the Reader used by the InputStream encoding - the encoding to use for the InputStream

Throws: UnsupportedEncodingException if the encoding is not supported

Method Detail

available

public int available()

See Also: java.io.InputStream#available()

close

public void close()

See Also: java.io.InputStream#close()

fillBuffer

protected void fillBuffer()

read

public int read()

See Also: java.io.InputStream#read()

read

public int read(byte[] data, int off, int len)

See Also: java.io.InputStream#read(byte[], int, int)

Copyright © 2011. All Rights Reserved.