|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.util.FileLines
public class FileLines
This class takes a filename and allows you to iterate through it line by line. It does _not_ read in the whole file immediately and instead reads in a new line every time the iterator is called.
Field Summary | |
---|---|
static String |
DEFAULT_ENCODING
|
Constructor Summary | |
---|---|
FileLines(String filename)
Constructs a new FileLines object for reading lines from the given filename; checks that the file exists upon creation, but does not read until an iterator is created. |
|
FileLines(String filename,
String encoding)
Constructs a new FileLines object for reading lines from the given filename which is in the given encoding; if encoding is not recognized, uses the default encoding for your platform |
|
FileLines(String filename,
String encoding,
boolean trim)
Constructs a new FileLines object for reading lines from the given filename which is in the given encoding; if encoding is not recognized, uses a default encoding. |
|
FileLines(String filename,
String encoding,
boolean trim,
Function<String,String> function)
Constructs a new FileLines object for reading lines from the given filename which is in the given encoding; if encoding is not recognized, uses a default encoding. |
Method Summary | ||
---|---|---|
boolean |
add(String arg0)
Unsupported Operation. |
|
boolean |
addAll(Collection<? extends String> c)
Unsupported Operation. |
|
void |
clear()
Unsupported Operation. |
|
boolean |
contains(Object o)
Can be slow. |
|
boolean |
containsAll(Collection<?> c)
Can be slow. |
|
Iterator<String> |
getIterator(Reader r)
|
|
boolean |
isEmpty()
|
|
Iterator<String> |
iterator()
|
|
static void |
main(String[] args)
|
|
boolean |
remove(Object o)
Unsupported Operation. |
|
boolean |
removeAll(Collection<?> c)
Unsupported Operation. |
|
boolean |
retainAll(Collection<?> c)
Unsupported Operation. |
|
int |
size()
Can be slow. |
|
Object[] |
toArray()
Can be slow. |
|
|
toArray(T[] a)
Can be slow. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Field Detail |
---|
public static final String DEFAULT_ENCODING
Constructor Detail |
---|
public FileLines(String filename)
filename
- The file to be openedpublic FileLines(String filename, String encoding)
filename
- The file to be openedencoding
- The char encoding to be usedpublic FileLines(String filename, String encoding, boolean trim)
filename
- public FileLines(String filename, String encoding, boolean trim, Function<String,String> function)
filename
- Method Detail |
---|
public Iterator<String> iterator()
iterator
in interface Iterable<String>
iterator
in interface Collection<String>
public boolean add(String arg0)
add
in interface Collection<String>
public boolean addAll(Collection<? extends String> c)
addAll
in interface Collection<String>
public void clear()
clear
in interface Collection<String>
public boolean contains(Object o)
contains
in interface Collection<String>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<String>
public boolean isEmpty()
isEmpty
in interface Collection<String>
public boolean remove(Object o)
remove
in interface Collection<String>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<String>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<String>
public int size()
size
in interface Collection<String>
public Object[] toArray()
toArray
in interface Collection<String>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<String>
public Iterator<String> getIterator(Reader r)
getIterator
in interface IteratorFromReaderFactory<String>
public static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |