gate.util
Class BomStrippingInputStreamReader
java.lang.Object
java.io.Reader
java.io.BufferedReader
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.
pendingConstructionException
private IOException pendingConstructionException
pendingEOF
private boolean pendingEOF
pendingChecked
private boolean pendingChecked
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
private BomStrippingInputStreamReader(InputStreamReader isr,
int bufferSize)
BomStrippingInputStreamReader
private BomStrippingInputStreamReader(InputStreamReader isr)
BomStrippingInputStreamReader
public BomStrippingInputStreamReader(InputStream in,
CharsetDecoder dec)
stripBomIfPresent
private void stripBomIfPresent()
- Checks whether the first character is BOM and positions the input stream
past it, if that's the case.
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
equals
public boolean equals(Object obj)
- Overrides:
equals in class Object
checkPending
private boolean checkPending()
throws IOException
- Throws:
IOException
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