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 boolean
protected int
protected boolean
protected String
protected long
protected String
protected int
protected T
protected String
protected BufferedReader
protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close fileprotected int
Guess number of newline characters used (e.g.long
Get position within filegetLine()
int
protected void
Guess number of newline characters used (e.g.boolean
hasNext()
boolean
hasSeek()
Is 'seek' operation supported?protected void
Initializeboolean
isDebug()
iterator()
load()
Load all elements from a file into a listnext()
protected String
readLine()
Read a line from readerprotected abstract T
readNext()
Read next elementprotected boolean
ready()
Is reader ready? I.e.void
remove()
void
seek
(long pos) Seek to 'pos' (jump to byte number 'pos' in the filevoid
setAutoClose
(boolean autoClose) void
setDebug
(boolean debug) void
setVerbose
(boolean verbose) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods 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
-