codec
Class UTF8InputStreamReader
java.lang.Object
|
+--java.io.Reader
|
+--codec.UTF8InputStreamReader
- public class UTF8InputStreamReader
- extends Reader
This class provides efficient UTF8 reading capability as a sub-class of
java.io.Reader. It is able to buffer, and translate from an
UTF8 input stream to Unicode characters. Method readLine() can
return a single line of material as a Java string.
For best performance, call new UTF8InputStreamReader(in, 2048)
instead of new BufferedReader(new InputStreamReader(new
BufferedInputStream(in, 2048), "UTF8" ), 1)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
numbytes_
protected int numbytes_
hasExtra_
protected int hasExtra_
extraCh_
protected char extraCh_
byteptr_
protected int byteptr_
ins_
protected InputStream ins_
bytebuf_
protected byte[] bytebuf_
UTF8InputStreamReader
public UTF8InputStreamReader(InputStream i,
int bufsize)
- This constructor initializes an UTF8InputStreamReader.
- Parameters:
i - the InputStream object from which the input will be read.bufsize - the size which must be buffered.
getEncoding
public String getEncoding()
checkOpen
protected void checkOpen()
throws IOException
- Checks whether the InputStream, with which this object is initialized, is
initialized.
- Throws:
IOException - if the InputStream is null
read
public int read()
throws IOException
- Overrides:
read in class Reader
- See Also:
Reader.read()
read
public int read(char[] cbuf,
int off,
int len)
throws IOException
- Overrides:
read in class Reader
- See Also:
Reader.read(char[], int, int)
readLine
public String readLine()
throws IOException
- Read from UTF8 stream until end of line, and return the content as a Java
String. A line is considered to be terminated by any one of a line feed
('\n'), a carriage return ('\r'), or a carriage return followed by a
linefeed.
- Returns:
- A String containing the contents of the line, not including any
line-termination characters, or null if the end of the stream has
been reached.
- Throws:
IOException - if an I/O error occurs.
ready
public boolean ready()
throws IOException
- Overrides:
ready in class Reader
- See Also:
Reader.ready()
close
public void close()
throws IOException
- Overrides:
close in class Reader
characterDecodingException
protected void characterDecodingException()
throws IOException
Copyright © Fraunhofer Gesellschaft. All Rights Reserved.