GXPARSE hosted by SourceForge.net Logo

ca.gorman.io
Class BinaryFileReader

java.lang.Object
  extended by java.io.Reader
      extended by ca.gorman.io.BinaryFileReader
All Implemented Interfaces:
Closeable, Readable

public class BinaryFileReader
extends Reader

Convenience class for reading characters from a File without translation from a Charset.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
BinaryFileReader(File file)
           Construct on a File.
 
Method Summary
 void close()
           Close the stream.
 int read()
           Read a single character.
 int read(char[] cbuf, int off, int len)
           Read characters.
 
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
 

Constructor Detail

BinaryFileReader

public BinaryFileReader(File file)
                 throws IOException

Construct on a File.

Throws:
NullPointerException - if file is null
IOException
Method Detail

read

public int read()
         throws IOException

Read a single character.

Overrides:
read in class Reader
Returns:
an int that contains the character in the low 16-bits.
Throws:
EOFException - if the file ends in the middle of a character
IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException

Read characters.

Specified by:
read in class Reader
Parameters:
cbuf - characters to read
off - offset to first character
len - number to read
Throws:
IndexOutOfBoundsException - if off, len, or their sum have values that would identify characters outside the bounds of the array.
NullPointerException - if cbuf is null
EOFException - if the file ends in the middle of a character
IOException

close

public void close()
           throws IOException

Close the stream. Any subsequent invocations of this method will be ignored, but subsequent invocations of read methods will throw an IOException.

Specified by:
close in interface Closeable
Specified by:
close in class Reader
Throws:
IOException

GXPARSE download

GXPARSE Generic XML Stream Parser API and supporting tools.   Release $Name: gxparse-sf-alpha-2_0 $
Copyright 2003-2004 Ian E. Gorman
Released under GNU Lesser General Public License