Class ArffUtilities
- java.lang.Object
-
- ai.libs.jaicore.ml.core.filter.sampling.infiles.ArffUtilities
-
public class ArffUtilities extends java.lang.ObjectUtility class for handling Arff dataset files.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcountDatasetEntries(java.io.File file, boolean hasHeader)Counts the amount of datapoint entries in an ARFF file.static java.lang.StringextractArffHeader(java.io.File file)Extract the header of an ARFF file as a string.static voidskipWithReaderToDatapoints(java.io.BufferedReader reader)Skips with a given reader all comment lines and the header lines of an ARFF file until the first datapoint is reached.
-
-
-
Method Detail
-
extractArffHeader
public static java.lang.String extractArffHeader(java.io.File file) throws java.io.IOExceptionExtract the header of an ARFF file as a string.- Parameters:
file- Given ARFF file of which the header shall be extracted.- Returns:
- Header of the given ARFF file.
- Throws:
java.io.IOException- Could not read from the given file.
-
countDatasetEntries
public static int countDatasetEntries(java.io.File file, boolean hasHeader) throws java.io.IOExceptionCounts the amount of datapoint entries in an ARFF file.- Parameters:
file- Given ARFF file where the entries are written in.hasHeader- If true the count will start after an '@data' annotation, otherwise it will just count every line, which is not a comment.- Returns:
- Amount of datapoint entries.
- Throws:
java.io.IOException- Could not read from the given file.
-
skipWithReaderToDatapoints
public static void skipWithReaderToDatapoints(java.io.BufferedReader reader) throws java.io.IOExceptionSkips with a given reader all comment lines and the header lines of an ARFF file until the first datapoint is reached.- Parameters:
reader- Reader that should be skipped to the data.- Throws:
java.io.IOException- Reader was not able to read the file.
-
-