org.eclipse.ercp.xml.io
Class StreamDecoder_ASCII

java.lang.Object
  extended by java.io.Reader
      extended by org.eclipse.ercp.xml.io.StreamDecoder_ASCII
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class StreamDecoder_ASCII
extends java.io.Reader

StreamDecoder for the ASCII encoding


Field Summary
protected  SimpleBufferedInputStream stream
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
StreamDecoder_ASCII(SimpleBufferedInputStream stream)
          Constructor for StreamDecoder_ISO8859_1.
 
Method Summary
 void close()
          Close this Reader.
 java.lang.String getEncoding()
          Return the encoding name
 int read()
          Reads a single character from this reader and returns the result as an int.
 int read(char[] buf, int offset, int count)
          Reads at most count characters from this Reader and stores them at offset in the character array buf.
 void restore()
          If the decoder read too much bytes during the last read (cf.
 boolean supportNewEncoding()
          Return tru if the receiver didn't affect the InputStream not allowing the switch to another encoding
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stream

protected SimpleBufferedInputStream stream
Constructor Detail

StreamDecoder_ASCII

public StreamDecoder_ASCII(SimpleBufferedInputStream stream)
Constructor for StreamDecoder_ISO8859_1.

Parameters:
stream -
Method Detail

close

public void close()
           throws java.io.IOException
Close this Reader. This must be implemented by any concrete subclasses. The implementation should free any resources associated with the Reader.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException - If an error occurs attempting to close this Reader.
See Also:
org.eclipse.ercp.sax2.parser.StreamDecoder#close()

read

public int read()
         throws java.io.IOException
Reads a single character from this reader and returns the result as an int. The 2 higher-order characters are set to 0. If the end of reader was encountered then return -1.

Returns:
the character read or -1 if end of reader.
Throws:
java.io.IOException - If the Reader is already closed or some other IO error occurs.
See Also:
org.eclipse.ercp.sax2.parser.StreamDecoder#read()

read

public int read(char[] buf,
                int offset,
                int count)
         throws java.io.IOException
Reads at most count characters from this Reader and stores them at offset in the character array buf. Returns the number of characters actually read or -1 if the end of reader was encountered.

Parameters:
buf - character array to store the read characters
offset - offset in buf to store the read characters
count - maximum number of characters to read
Returns:
the number of characters read or -1 if end of reader.
Throws:
java.io.IOException - If the Reader is already closed or some other IO error occurs.
See Also:
org.eclipse.ercp.sax2.parser.StreamDecoder#read(char[], int, int)

supportNewEncoding

public boolean supportNewEncoding()
Return tru if the receiver didn't affect the InputStream not allowing the switch to another encoding


restore

public void restore()
If the decoder read too much bytes during the last read (cf. UTF8) restore them!


getEncoding

public java.lang.String getEncoding()
Return the encoding name