public class DelimitedWordReader extends FastBufferedReader
This class is a simple subclass of FastBufferedReader
. It
overwrites isWordConstituent(char)
so that word constituents
are defined negatively by a set of delimiters defined at construction time.
There is a constructor
accepting the delimiter set as a string
. Note that LF and CR are always considered to be delimiters.
avail, buffer, bufferSize, DEFAULT_BUFFER_SIZE, pos, reader, wordConstituents
Constructor and Description |
---|
DelimitedWordReader(char[] array,
it.unimi.dsi.fastutil.chars.CharSet delimiters)
Creates a new delimited word reader by wrapping a given character array and using a set delimiters.
|
DelimitedWordReader(char[] array,
int offset,
int length,
it.unimi.dsi.fastutil.chars.CharSet delimiters)
Creates a new delimited word reader by wrapping a given fragment of a character array and using a set delimiters.
|
DelimitedWordReader(it.unimi.dsi.fastutil.chars.CharSet delimiters)
Creates a new delimited word reader with a buffer of
FastBufferedReader.DEFAULT_BUFFER_SIZE characters. |
DelimitedWordReader(int bufferSize,
it.unimi.dsi.fastutil.chars.CharSet delimiters)
Creates a new delimited word reader with a given buffer size and set of delimiters.
|
DelimitedWordReader(MutableString s,
it.unimi.dsi.fastutil.chars.CharSet delimiters)
Creates a new delimited word reader by wrapping a given mutable string and using a set of delimiters.
|
DelimitedWordReader(Reader r,
it.unimi.dsi.fastutil.chars.CharSet delimiters)
Creates a new delimited word reader by wrapping a given reader with a buffer of
FastBufferedReader.DEFAULT_BUFFER_SIZE characters using a given set of delimiters. |
DelimitedWordReader(Reader r,
int bufferSize,
it.unimi.dsi.fastutil.chars.CharSet delimiters)
Creates a new delimited word reader by wrapping a given reader with a given buffer size and using a set of delimiters.
|
DelimitedWordReader(String delimiters)
Creates a new delimited word reader with a buffer of
FastBufferedReader.DEFAULT_BUFFER_SIZE characters. |
DelimitedWordReader(String bufferSize,
String delimiters)
Creates a new delimited word reader with a given buffer size and set of delimiters.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
isWordConstituent(char c)
Returns whether the given character is a word constituent.
|
String |
toSpec() |
String |
toString() |
close, copy, next, noMoreCharacters, read, read, readLine, setReader, skip
public DelimitedWordReader(int bufferSize, it.unimi.dsi.fastutil.chars.CharSet delimiters)
FastBufferedReader.setReader(Reader)
.bufferSize
- the size in bytes of the internal buffer.delimiters
- a set of characters that will be considered word delimiters.public DelimitedWordReader(it.unimi.dsi.fastutil.chars.CharSet delimiters)
FastBufferedReader.DEFAULT_BUFFER_SIZE
characters.
The wrapped reader will have to be set later using FastBufferedReader.setReader(Reader)
.delimiters
- a set of characters that will be considered word delimiters.public DelimitedWordReader(String delimiters)
FastBufferedReader.DEFAULT_BUFFER_SIZE
characters.
The wrapped reader will have to be set later using FastBufferedReader.setReader(Reader)
.delimiters
- a set of characters that will be considered word delimiters, specified as a string.public DelimitedWordReader(String bufferSize, String delimiters)
FastBufferedReader.setReader(Reader)
.bufferSize
- the size in bytes of the internal buffer, specified as a string.delimiters
- a set of characters that will be considered word delimiters, specified as a string.public DelimitedWordReader(Reader r, int bufferSize, it.unimi.dsi.fastutil.chars.CharSet delimiters)
r
- a reader to wrap.bufferSize
- the size in bytes of the internal buffer.delimiters
- a set of characters that will be considered word delimiters.public DelimitedWordReader(Reader r, it.unimi.dsi.fastutil.chars.CharSet delimiters)
FastBufferedReader.DEFAULT_BUFFER_SIZE
characters using a given set of delimiters.r
- a reader to wrap.delimiters
- a set of characters that will be considered word delimiters.public DelimitedWordReader(char[] array, int offset, int length, it.unimi.dsi.fastutil.chars.CharSet delimiters)
The effect of FastBufferedReader.setReader(Reader)
on a buffer created with
this constructor is undefined.
array
- the array that will be wrapped by the reader.offset
- the first character to be used.length
- the number of character to be used.delimiters
- a set of characters that will be considered word delimiters.public DelimitedWordReader(char[] array, it.unimi.dsi.fastutil.chars.CharSet delimiters)
The effect of FastBufferedReader.setReader(Reader)
on a buffer created with
this constructor is undefined.
array
- the array that will be wrapped by the reader.delimiters
- a set of characters that will be considered word delimiters.public DelimitedWordReader(MutableString s, it.unimi.dsi.fastutil.chars.CharSet delimiters)
The effect of FastBufferedReader.setReader(Reader)
on a buffer created with
this constructor is undefined.
s
- the mutable string that will be wrapped by the reader.delimiters
- a set of characters that will be considered word delimiters.protected boolean isWordConstituent(char c)
FastBufferedReader
The behaviour of this FastBufferedReader
as a WordReader
can
be radically changed by overwriting this method.
isWordConstituent
in class FastBufferedReader
c
- a character.c
should be considered a word constituent.public String toSpec()
toSpec
in class FastBufferedReader
public String toString()
toString
in class FastBufferedReader
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.