Sharkysoft home

lava.io
Class AsciiInputStreamReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--lava.io.AsciiInputStreamReader

public final class AsciiInputStreamReader
extends java.io.Reader

Converts byte stream to char stream without decoding.

Details: AsciiInputStreamReader converts a binary InputStream to a Reader. Each byte from the source InputStream is converted to a char. This class is useful for parsing streams that contain mixtures of ASCII and binary data.

Since:
1998.09.27

Fields inherited from class java.io.Reader
lock
 
Constructor Summary
AsciiInputStreamReader(java.io.InputStream in)
          Initializes with InputStream.
 
Method Summary
 void close()
          Closes this Reader.
 int read()
          Reads one byte.
 int read(char[] buff, int off, int len)
          Reads bytes from the input stream.
 
Methods inherited from class java.io.Reader
mark, markSupported, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsciiInputStreamReader

public AsciiInputStreamReader(java.io.InputStream in)
Initializes with InputStream.

Details: This constructor initializes a new AsciiInputStreamReader with the given InputStream.

Parameters:
in - the InputStream
Method Detail

read

public int read()
         throws java.io.IOException
Reads one byte.

Details: read reads a single byte from the InputStream and returns it as a char.

Overrides:
read in class java.io.Reader
Returns:
the byte

read

public int read(char[] buff,
                int off,
                int len)
         throws java.io.IOException
Reads bytes from the input stream.

Details: read reads len bytes from the InputStream, converts them to chars, and stores them in buff, beginning at offset off. The return value is the number of bytes read and converted, or -1 if no bytes were read and the EOS was reached.

Overrides:
read in class java.io.Reader
Parameters:
buff - the destination buffer
off - the offset
len - the number of bytes to read
Returns:
the number of bytes read
Throws:
java.io.IOException - if an I/O error occurs

close

public void close()
           throws java.io.IOException
Closes this Reader.

Details: close closes the source InputStream by calling it's close method.

Overrides:
close in class java.io.Reader
Throws:
java.io.IOException - if an I/O error occurs

Sharkysoft home