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.PushbackReader
Class 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 void
close()
java.nio.charset.Charset
getCharset()
Get the Charset used to decode bytes from the input stream.void
mark(int readAheadLimit)
boolean
markSupported()
int
read()
int
read(char[] cbuf)
int
read(char[] cbuf, int off, int len)
int
read(java.nio.CharBuffer cb)
boolean
ready()
void
reset()
void
setCharset(java.nio.charset.Charset cs)
Change the Charset used to decode bytes from the input stream into characters.long
skip(long n)
Skips 'n' characters, or as many as can be read off the stream before its end.void
unread(char[] cbuf)
void
unread(char[] cbuf, int off, int len)
Unread the character array into the reader.void
unread(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:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.PushbackReader
- Throws:
java.io.IOException
-
mark
public final void mark(int readAheadLimit) throws java.io.IOException
- Overrides:
mark
in classjava.io.PushbackReader
- Throws:
java.io.IOException
-
markSupported
public final boolean markSupported()
- Overrides:
markSupported
in classjava.io.PushbackReader
-
ready
public final boolean ready() throws java.io.IOException
- Overrides:
ready
in classjava.io.PushbackReader
- Throws:
java.io.IOException
-
reset
public final void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.PushbackReader
- Throws:
java.io.IOException
-
skip
public final long skip(long n) throws java.io.IOException
Skips 'n' characters, or as many as can be read off the stream before its end. Returns the number of characters actually skipped- Overrides:
skip
in classjava.io.PushbackReader
- Throws:
java.io.IOException
-
unread
public final void unread(int c) throws java.io.IOException
Unread a single code point. Decomposes the code point into UTF-16 surrogate pairs and unreads them using the char[] unreader function.- Overrides:
unread
in classjava.io.PushbackReader
- Throws:
java.io.IOException
-
unread
public final void unread(char[] cbuf, int off, int len) throws java.io.IOException
Unread 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:
unread
in classjava.io.PushbackReader
- Throws:
java.io.IOException
-
unread
public final void unread(char[] cbuf) throws java.io.IOException
- Overrides:
unread
in classjava.io.PushbackReader
- Throws:
java.io.IOException
-
read
public final int read() throws java.io.IOException
- Overrides:
read
in classjava.io.PushbackReader
- Throws:
java.io.IOException
-
read
public final int read(char[] cbuf, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.PushbackReader
- Throws:
java.io.IOException
-
read
public final int read(java.nio.CharBuffer cb) throws java.io.IOException
- Specified by:
read
in interfacejava.lang.Readable
- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
read
public final int read(char[] cbuf) throws java.io.IOException
- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
-