javatools.filehandlers
Class SimpleInputStreamReader
java.lang.Object
java.io.Reader
javatools.filehandlers.SimpleInputStreamReader
- All Implemented Interfaces:
- java.io.Closeable, java.lang.Readable
public class SimpleInputStreamReader
- 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).
A SimpleInputStreamReader reads the bytes from an InputStream and passes them
on as characters -- regardless of the encoding.
Example:
// It does not work like this
Reader r=new InputStreamReader(new ByteArrayInputStream(new byte[]{(byte)144}));
System.out.println(r.read());
r.close();
-----> 65533
// But it does like this
r=new SimpleInputStreamReader(new ByteArrayInputStream(new byte[]{(byte)144}));
System.out.println(r.read());
r.close();
-----> 144
Field Summary |
java.io.InputStream |
in
|
Method Summary |
void |
close()
|
static void |
main(java.lang.String[] args)
|
int |
read()
|
int |
read(char[] cbuf,
int off,
int len)
|
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 |
in
public java.io.InputStream in
SimpleInputStreamReader
public SimpleInputStreamReader(java.io.InputStream i)
SimpleInputStreamReader
public SimpleInputStreamReader(java.io.File f)
throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
SimpleInputStreamReader
public SimpleInputStreamReader(java.lang.String f)
throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
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
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Throws:
java.lang.Exception