javatools.filehandlers
Class UTF8Reader

java.lang.Object
  extended by java.io.Reader
      extended by javatools.filehandlers.UTF8Reader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class UTF8Reader
extends java.io.Reader

This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). This class can read characters from a file that is UTF8 encoded.
Example:

 Reader f=new UTF8Reader(new File("blah.blb"));
 int c;
 while((c=f.read())!=-1) System.out.print(Char.normalize(c));
 f.close();
 


Constructor Summary
UTF8Reader(java.io.File f)
          Constructs a UTF8Reader from a File
UTF8Reader(java.io.File f, java.lang.String message)
          Constructs a UTF8Reader from a File, makes a nice progress bar
UTF8Reader(java.io.InputStream s)
          Constructs a UTF8Reader from a Reader
UTF8Reader(java.lang.String f)
          Constructs a UTF8Reader from a File
UTF8Reader(java.lang.String f, java.lang.String message)
          Constructs a UTF8Reader from a File, makes a nice progress bar
UTF8Reader(java.net.URL url)
          Constructs a UTF8Reader for an URL
 
Method Summary
 void close()
           
static void main(java.lang.String[] args)
          Test method
 long numBytesRead()
          Returns the number of bytes read from the underlying stream
 int read()
           
 int read(char[] cbuf, int off, int len)
           
 java.lang.String readLine()
          Reads a line
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UTF8Reader

public UTF8Reader(java.io.InputStream s)
Constructs a UTF8Reader from a Reader


UTF8Reader

public UTF8Reader(java.net.URL url)
           throws java.io.IOException
Constructs a UTF8Reader for an URL

Throws:
java.io.IOException

UTF8Reader

public UTF8Reader(java.io.File f)
           throws java.io.FileNotFoundException
Constructs a UTF8Reader from a File

Throws:
java.io.FileNotFoundException

UTF8Reader

public UTF8Reader(java.io.File f,
                  java.lang.String message)
           throws java.io.FileNotFoundException
Constructs a UTF8Reader from a File, makes a nice progress bar

Throws:
java.io.FileNotFoundException

UTF8Reader

public UTF8Reader(java.lang.String f)
           throws java.io.FileNotFoundException
Constructs a UTF8Reader from a File

Throws:
java.io.FileNotFoundException

UTF8Reader

public UTF8Reader(java.lang.String f,
                  java.lang.String message)
           throws java.io.FileNotFoundException
Constructs a UTF8Reader from a File, makes a nice progress bar

Throws:
java.io.FileNotFoundException
Method Detail

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Reader
Throws:
java.io.IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Specified by:
read in class java.io.Reader
Throws:
java.io.IOException

read

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

numBytesRead

public long numBytesRead()
Returns the number of bytes read from the underlying stream


readLine

public java.lang.String readLine()
                          throws java.io.IOException
Reads a line

Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Test method

Throws:
java.io.IOException