Package org.snpeff.fileIterator
Class FileIterator<T>
java.lang.Object
org.snpeff.fileIterator.FileIterator<T>
- Direct Known Subclasses:
FastaFileIterator,LineClassFileIterator,LineFileIterator,MarkerFileIterator,PedFileIterator,SamFileIterator
Opens a file and iterates over all objects in the file
Note: The file is not loaded in memory, thus allows to iterate over very large files
- Author:
- pcingola
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected intprotected booleanprotected Stringprotected longprotected Stringprotected intprotected Tprotected Stringprotected BufferedReaderprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close fileprotected intGuess number of newline characters used (e.g.longGet position within filegetLine()intprotected voidGuess number of newline characters used (e.g.booleanhasNext()booleanhasSeek()Is 'seek' operation supported?protected voidInitializebooleanisDebug()iterator()load()Load all elements from a file into a listnext()protected StringreadLine()Read a line from readerprotected abstract TreadNext()Read next elementprotected booleanready()Is reader ready? I.e.voidremove()voidseek(long pos) Seek to 'pos' (jump to byte number 'pos' in the filevoidsetAutoClose(boolean autoClose) voidsetDebug(boolean debug) voidsetVerbose(boolean verbose) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
debug
protected boolean debug -
verbose
protected boolean verbose -
autoClose
protected boolean autoClose -
countNewLineChars
protected int countNewLineChars -
lineNum
protected int lineNum -
next
-
reader
-
fileName
-
line
-
nextLine
-
fileSize
protected long fileSize
-
-
Constructor Details
-
FileIterator
-
FileIterator
-
-
Method Details
-
close
public void close()Close file -
countNewLineChars
protected int countNewLineChars()Guess number of newline characters used (e.g. '\n' or '\r\n' -
getFilePointer
public long getFilePointer()Get position within file -
getLine
-
getLineNum
public int getLineNum() -
guessNewLineChars
protected void guessNewLineChars()Guess number of newline characters used (e.g. '\n' or '\r\n' Make sure we return to the current read position -
hasNext
public boolean hasNext() -
hasSeek
public boolean hasSeek()Is 'seek' operation supported? -
init
Initialize- Parameters:
fileName- : Can be null (no file is opened)
-
isDebug
public boolean isDebug() -
iterator
-
load
Load all elements from a file into a list -
next
-
readLine
Read a line from reader- Throws:
IOException
-
readNext
Read next element -
ready
Is reader ready? I.e. Can we read a line?- Throws:
IOException
-
remove
public void remove() -
seek
Seek to 'pos' (jump to byte number 'pos' in the file- Throws:
IOException
-
setAutoClose
public void setAutoClose(boolean autoClose) -
setDebug
public void setDebug(boolean debug) -
setVerbose
public void setVerbose(boolean verbose) -
toString
-