org.armedbear.lisp.util
Class DecodingReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.FilterReader
          extended by java.io.PushbackReader
              extended by org.armedbear.lisp.util.DecodingReader
All Implemented Interfaces:
java.io.Closeable, 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.


Field Summary
 
Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
DecodingReader(java.io.InputStream stream, int size, java.nio.charset.Charset cs)
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecodingReader

public DecodingReader(java.io.InputStream stream,
                      int size,
                      java.nio.charset.Charset cs)
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 interface java.io.Closeable
Overrides:
close in class java.io.PushbackReader
Throws:
java.io.IOException

mark

public final void mark(int readAheadLimit)
                throws java.io.IOException
Overrides:
mark in class java.io.PushbackReader
Throws:
java.io.IOException

markSupported

public final boolean markSupported()
Overrides:
markSupported in class java.io.PushbackReader

ready

public final boolean ready()
                    throws java.io.IOException
Overrides:
ready in class java.io.PushbackReader
Throws:
java.io.IOException

reset

public final void reset()
                 throws java.io.IOException
Overrides:
reset in class java.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 class java.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 class java.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 class java.io.PushbackReader
Throws:
java.io.IOException

unread

public final void unread(char[] cbuf)
                  throws java.io.IOException
Overrides:
unread in class java.io.PushbackReader
Throws:
java.io.IOException

read

public final int read()
               throws java.io.IOException
Overrides:
read in class java.io.PushbackReader
Throws:
java.io.IOException

read

public final int read(char[] cbuf,
                      int off,
                      int len)
               throws java.io.IOException
Overrides:
read in class java.io.PushbackReader
Throws:
java.io.IOException

read

public final int read(java.nio.CharBuffer cb)
               throws java.io.IOException
Specified by:
read in interface java.lang.Readable
Overrides:
read in class java.io.Reader
Throws:
java.io.IOException

read

public final int read(char[] cbuf)
               throws java.io.IOException
Overrides:
read in class java.io.Reader
Throws:
java.io.IOException