Google Data APIs Client Library (1.41.1)



com.google.gdata.util.io.base
Class UnicodeReader

java.lang.Object
  extended by java.io.Reader
      extended by com.google.gdata.util.io.base.UnicodeReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class UnicodeReader
extends java.io.Reader

Generic Unicode text reader, which uses a BOM (Byte Order Mark) to identify the encoding to be used. This also has the side effect of removing the BOM from the input stream (when present).

See Also:
JDK Bug 4508058

Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
UnicodeReader(java.io.InputStream in, java.lang.String defaultEnc)
           
 
Method Summary
 void close()
           
 java.lang.String getDefaultEncoding()
           
 java.lang.String getEncoding()
           
 int read(char[] cbuf, int off, int len)
           
 
Methods inherited from class java.io.Reader
mark, markSupported, read, 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

UnicodeReader

public UnicodeReader(java.io.InputStream in,
                     java.lang.String defaultEnc)
              throws java.io.IOException
Parameters:
in - input stream
defaultEnc - default encoding (used only if BOM is not found) or null to use system default
Throws:
java.io.IOException - if an I/O error occurs
Method Detail

getDefaultEncoding

public java.lang.String getDefaultEncoding()

getEncoding

public java.lang.String getEncoding()

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