org.jlab.groot.io
Class TextFileReader
- java.lang.Object
-
- org.jlab.groot.io.TextFileReader
-
public class TextFileReader extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor and Description TextFileReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description double[]getAsDouble(int[] index)Returns specified columns as array of doubledouble[]getAsDouble(int min, int max)int[]getAsInt(int[] index)returns specified columns as array of intsint[]getAsInt(int min, int max)returns array of ints for given range of columns.intgetDataSize()static voidmain(java.lang.String[] args)booleanopenFile(java.lang.String name)Open a text file for reading.booleanreadNext()reads the next line in the file and populates the internal list of tokensvoidshow()java.lang.StringtoString()returns string representation of the array that was read.
-
-
-
Method Detail
-
openFile
public boolean openFile(java.lang.String name)
Open a text file for reading.- Parameters:
name- name of the file- Returns:
-
readNext
public boolean readNext()
reads the next line in the file and populates the internal list of tokens- Returns:
- true if read was successful, false otherwise.
-
getDataSize
public int getDataSize()
-
getAsDouble
public double[] getAsDouble(int min, int max)
-
getAsDouble
public double[] getAsDouble(int[] index)
Returns specified columns as array of double- Parameters:
index- array containing columns indices- Returns:
-
getAsInt
public int[] getAsInt(int min, int max)returns array of ints for given range of columns.- Parameters:
min- min number of columnmax- max number of column- Returns:
-
getAsInt
public int[] getAsInt(int[] index)
returns specified columns as array of ints- Parameters:
index- array containing columns indices- Returns:
-
toString
public java.lang.String toString()
returns string representation of the array that was read.- Overrides:
toStringin classjava.lang.Object- Returns:
-
show
public void show()
-
main
public static void main(java.lang.String[] args)
-
-
DMelt 3.0 © DataMelt by jWork.ORG