Package org.armedbear.lisp.util
Class DecodingReader
- java.lang.Object
-
- java.io.Reader
-
- java.io.FilterReader
-
- java.io.PushbackReader
-
- org.armedbear.lisp.util.DecodingReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Readable
public class DecodingReader extends java.io.PushbackReaderClass to support mid-stream change of character encoding to support setExternalFormat operation in Stream.java Note: extends PushbackReader, but only for its interface; all methods are overridden.
-
-
Constructor Summary
Constructors Constructor Description DecodingReader(java.io.InputStream stream, int size, java.nio.charset.Charset cs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.nio.charset.CharsetgetCharset()Get the Charset used to decode bytes from the input stream.voidmark(int readAheadLimit)booleanmarkSupported()intread()intread(char[] cbuf)intread(char[] cbuf, int off, int len)intread(java.nio.CharBuffer cb)booleanready()voidreset()voidsetCharset(java.nio.charset.Charset cs)Change the Charset used to decode bytes from the input stream into characters.longskip(long n)Skips 'n' characters, or as many as can be read off the stream before its end.voidunread(char[] cbuf)voidunread(char[] cbuf, int off, int len)Unread the character array into the reader.voidunread(int c)Unread a single code point.
-
-
-
Method Detail
-
setCharset
public final void setCharset(java.nio.charset.Charset cs)
Change the Charset used to decode bytes from the input stream into characters.
-
getCharset
public final java.nio.charset.Charset getCharset()
Get the Charset used to decode bytes from the input stream.
-
close
public final void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.PushbackReader- Throws:
java.io.IOException
-
mark
public final void mark(int readAheadLimit) throws java.io.IOException- Overrides:
markin classjava.io.PushbackReader- Throws:
java.io.IOException
-
markSupported
public final boolean markSupported()
- Overrides:
markSupportedin classjava.io.PushbackReader
-
ready
public final boolean ready() throws java.io.IOException- Overrides:
readyin classjava.io.PushbackReader- Throws:
java.io.IOException
-
reset
public final void reset() throws java.io.IOException- Overrides:
resetin classjava.io.PushbackReader- Throws:
java.io.IOException
-
skip
public final long skip(long n) throws java.io.IOExceptionSkips 'n' characters, or as many as can be read off the stream before its end. Returns the number of characters actually skipped- Overrides:
skipin classjava.io.PushbackReader- Throws:
java.io.IOException
-
unread
public final void unread(int c) throws java.io.IOExceptionUnread a single code point. Decomposes the code point into UTF-16 surrogate pairs and unreads them using the char[] unreader function.- Overrides:
unreadin classjava.io.PushbackReader- Throws:
java.io.IOException
-
unread
public final void unread(char[] cbuf, int off, int len) throws java.io.IOExceptionUnread the character array into the reader. Decodes the characters in the array into bytes, allowing the encoding to be changed before reading from the stream again, using a different charset.- Overrides:
unreadin classjava.io.PushbackReader- Throws:
java.io.IOException
-
unread
public final void unread(char[] cbuf) throws java.io.IOException- Overrides:
unreadin classjava.io.PushbackReader- Throws:
java.io.IOException
-
read
public final int read() throws java.io.IOException- Overrides:
readin classjava.io.PushbackReader- Throws:
java.io.IOException
-
read
public final int read(char[] cbuf, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.PushbackReader- Throws:
java.io.IOException
-
read
public final int read(java.nio.CharBuffer cb) throws java.io.IOException- Specified by:
readin interfacejava.lang.Readable- Overrides:
readin classjava.io.Reader- Throws:
java.io.IOException
-
read
public final int read(char[] cbuf) throws java.io.IOException- Overrides:
readin classjava.io.Reader- Throws:
java.io.IOException
-
-