Class: java.io.CharArrayReader
- public class CharArrayReader
- extends Reader
This class implements a character buffer that can be used as a
character-input stream.
Methods
-
CharArrayReadertop
public CharArrayReader(char[] buf)Creates a CharArrayReader from the specified array of chars. -
CharArrayReadertop
public CharArrayReader(char[] buf, int offset, int length)Creates a CharArrayReader from the specified array of chars.The resulting reader will start reading at the given offset. The total number of char values that can be read from this reader will be either length or buf.length-offset, whichever is smaller.
-
closetop
public void close()Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect. -
marktop
public void mark(int readAheadLimit) throws IOExceptionMarks the present position in the stream. Subsequent calls to reset() will reposition the stream to this point. -
markSupportedtop
public boolean markSupported()Tells whether this stream supports the mark() operation, which it does.- Override hierarchy:
- markSupported from Reader
-
readtop
public int read() throws IOExceptionReads a single character. -
readtop
public int read(char[] b, int off, int len) throws IOExceptionReads characters into a portion of an array. -
readytop
public boolean ready() throws IOExceptionTells whether this stream is ready to be read. Character-array readers are always ready to be read. -
resettop
public void reset() throws IOExceptionResets the stream to the most recent mark, or to the beginning if it has never been marked. -
skiptop
public long skip(long n) throws IOExceptionSkips characters. Returns the number of characters that were skipped.The
nparameter may be negative, even though theskipmethod of the java.io.Reader superclass throws an exception in this case. Ifnis negative, then this method does nothing and returns0.
