gate.util
Class BomStrippingInputStreamReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.BufferedReader
          extended by gate.util.BomStrippingInputStreamReader
All Implemented Interfaces:
Closeable, Readable

public class BomStrippingInputStreamReader
extends BufferedReader

StreamReader that removes the Unicode BOM, even when Sun/Oracle is too lazy to do so. Since a buffer is required, and since most of GATE was coded to use BufferedReaders around the InputStreamReader, this 'isa' BufferedReader. Note that there are differences in exception behaviour on the different InputStreamReader constructors, so this has to be careful to call the right one.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
BomStrippingInputStreamReader(InputStream in)
           
BomStrippingInputStreamReader(InputStream in, Charset cs)
           
BomStrippingInputStreamReader(InputStream in, CharsetDecoder dec)
           
BomStrippingInputStreamReader(InputStream in, CharsetDecoder dec, int bufferSize)
           
BomStrippingInputStreamReader(InputStream in, int bufferSize)
           
BomStrippingInputStreamReader(InputStream in, String charsetName)
           
BomStrippingInputStreamReader(InputStream in, String charsetName, int bufferSize)
           
 
Method Summary
 void close()
           
 boolean equals(Object obj)
           
 int hashCode()
           
 void mark(int readAheadLimit)
           
 boolean markSupported()
           
 int read()
           
 int read(char[] cbuf)
           
 int read(char[] cbuf, int off, int len)
           
 int read(CharBuffer target)
           
 String readLine()
           
 boolean ready()
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BomStrippingInputStreamReader

public BomStrippingInputStreamReader(InputStream in)

BomStrippingInputStreamReader

public BomStrippingInputStreamReader(InputStream in,
                                     String charsetName)
                              throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

BomStrippingInputStreamReader

public BomStrippingInputStreamReader(InputStream in,
                                     String charsetName,
                                     int bufferSize)
                              throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

BomStrippingInputStreamReader

public BomStrippingInputStreamReader(InputStream in,
                                     Charset cs)

BomStrippingInputStreamReader

public BomStrippingInputStreamReader(InputStream in,
                                     int bufferSize)

BomStrippingInputStreamReader

public BomStrippingInputStreamReader(InputStream in,
                                     CharsetDecoder dec,
                                     int bufferSize)

BomStrippingInputStreamReader

public BomStrippingInputStreamReader(InputStream in,
                                     CharsetDecoder dec)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

read

public int read(CharBuffer target)
         throws IOException
Specified by:
read in interface Readable
Overrides:
read in class Reader
Throws:
IOException

read

public int read(char[] cbuf)
         throws IOException
Overrides:
read in class Reader
Throws:
IOException

read

public int read()
         throws IOException
Overrides:
read in class BufferedReader
Throws:
IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Overrides:
read in class BufferedReader
Throws:
IOException

readLine

public String readLine()
                throws IOException
Overrides:
readLine in class BufferedReader
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class BufferedReader
Throws:
IOException

ready

public boolean ready()
              throws IOException
Overrides:
ready in class BufferedReader
Throws:
IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class BufferedReader

mark

public void mark(int readAheadLimit)
          throws IOException
Overrides:
mark in class BufferedReader
Throws:
IOException

reset

public void reset()
           throws IOException
Overrides:
reset in class BufferedReader
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class BufferedReader
Throws:
IOException