Package org.terrier.utility
Class LookAheadStreamCaseInsensitive
- java.lang.Object
-
- java.io.InputStream
-
- org.terrier.utility.LookAheadStream
-
- org.terrier.utility.LookAheadStreamCaseInsensitive
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class LookAheadStreamCaseInsensitive extends LookAheadStream
Version of LookAheadStream that is case-insensitive. This version assumes that the characters that form the end-of-stream markers are single bytes, from the default character set. Use with care.- Since:
- 2.1
- Author:
- Craig Macdonald
-
-
Field Summary
-
Fields inherited from class org.terrier.utility.LookAheadStream
Buffer, BufIndex, BufLen, EndMarker, EOF, MarkerLen, ParentStream
-
-
Constructor Summary
Constructors Constructor Description LookAheadStreamCaseInsensitive(java.io.InputStream parent, java.lang.String endMarker)
Create a LookAheadStream that is case insensitive.LookAheadStreamCaseInsensitive(java.io.InputStream parent, java.lang.String endMarker, java.lang.String encoding)
Create a LookAheadStream that is case insensitive.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
read()
Read a character from the parent stream, first checking that it doesn't form part of the end marker.-
Methods inherited from class org.terrier.utility.LookAheadStream
close, mark, markSupported, read, read, ready, reset, skip
-
-
-
-
Constructor Detail
-
LookAheadStreamCaseInsensitive
public LookAheadStreamCaseInsensitive(java.io.InputStream parent, java.lang.String endMarker)
Create a LookAheadStream that is case insensitive. The default character set is used to parse the marker into bytes.- Parameters:
parent
- The InputStream to wrapendMarker
- the marker at which to give EOF
-
LookAheadStreamCaseInsensitive
public LookAheadStreamCaseInsensitive(java.io.InputStream parent, java.lang.String endMarker, java.lang.String encoding) throws java.io.UnsupportedEncodingException
Create a LookAheadStream that is case insensitive. The default character set is used to parse the marker into bytes.- Parameters:
parent
- The InputStream to wrapendMarker
- the marker at which to give EOFencoding
- name for encoding- Throws:
java.io.UnsupportedEncodingException
-
-
Method Detail
-
read
public int read() throws java.io.IOException
Read a character from the parent stream, first checking that it doesn't form part of the end marker.- Overrides:
read
in classLookAheadStream
- Returns:
- int the code of the read character, or -1 if the end of the stream has been reached.
- Throws:
java.io.IOException
- if there is any error while reading from the stream.
-
-