public final class CSVSaveService extends Object
| Modifier and Type | Field and Description |
|---|---|
static char |
QUOTING_CHAR |
| Modifier and Type | Method and Description |
|---|---|
static String[] |
csvReadFile(BufferedReader infile,
char delim)
Reads from file and splits input into strings according to the delimiter,
taking note of quoted strings.
|
static String[] |
csvSplitString(String line,
char delim)
Reads from String and splits into strings according to the delimiter,
taking note of quoted strings.
|
static SampleSaveConfiguration |
getSampleSaveConfiguration(String headerLine,
String filename)
Parse a CSV header line
|
static String |
printableFieldNamesToString()
Generates the field names for the output file
|
static String |
printableFieldNamesToString(SampleSaveConfiguration saveConfig)
Generates the field names for the output file
|
static void |
processSamples(String filename,
Visualizer visualizer,
ResultCollector resultCollector)
Read Samples from a file; handles quoted strings.
|
static String |
resultToDelimitedString(SampleEvent event)
Convert a result into a string, where the fields of the result are
separated by the default delimiter.
|
static String |
resultToDelimitedString(SampleEvent event,
String delimiter)
Convert a result into a string, where the fields of the result are
separated by a specified String.
|
static void |
saveCSVStats(DefaultTableModel model,
FileWriter writer)
Method saves aggregate statistics (with header names) as CSV from a table
model.
|
static void |
saveCSVStats(DefaultTableModel model,
FileWriter writer,
boolean saveHeaders)
Method saves aggregate statistics as CSV from a table model.
|
static void |
saveCSVStats(List<?> data,
FileWriter writer)
Method will save aggregate statistics as CSV.
|
static void |
saveCSVStats(List<?> data,
FileWriter writer,
String[] headers)
Method will save aggregate statistics as CSV.
|
public static final char QUOTING_CHAR
public static void processSamples(String filename, Visualizer visualizer, ResultCollector resultCollector) throws IOException
filename - input filevisualizer - where to send the resultsresultCollector - the parent collectorIOExceptionpublic static String printableFieldNamesToString()
public static String printableFieldNamesToString(SampleSaveConfiguration saveConfig)
public static SampleSaveConfiguration getSampleSaveConfiguration(String headerLine, String filename)
headerLine - from CSV filefilename - name of file (for log message only)public static void saveCSVStats(List<?> data, FileWriter writer) throws IOException
data - List of data rowswriter - output fileIOExceptionpublic static void saveCSVStats(List<?> data, FileWriter writer, String[] headers) throws IOException
data - List of data rowswriter - output fileheaders - header names (if non-null)IOExceptionpublic static void saveCSVStats(DefaultTableModel model, FileWriter writer) throws IOException
saveCSVStats(List, FileWriter, String[]) except
that there is no need to create a List containing the data.model - table model containing the datawriter - output fileIOExceptionpublic static void saveCSVStats(DefaultTableModel model, FileWriter writer, boolean saveHeaders) throws IOException
saveCSVStats(List, FileWriter, String[]) except that there is
no need to create a List containing the data.model - table model containing the datawriter - output filesaveHeaders - whether or not to save headersIOExceptionpublic static String resultToDelimitedString(SampleEvent event)
event - the sample event to be convertedpublic static String resultToDelimitedString(SampleEvent event, String delimiter)
event - the sample event to be converteddelimiter - the separation stringpublic static String[] csvReadFile(BufferedReader infile, char delim) throws IOException
Handles DOS (CRLF), Unix (LF), and Mac (CR) line-endings equally.
A blank line - or a quoted blank line - both return an array containing a single empty String.
infile - input file - must support mark(1)delim - delimiter (e.g. comma)IOException - also for unexpected quote characterspublic static String[] csvSplitString(String line, char delim) throws IOException
line - input linedelim - delimiter (e.g. comma)IOException - also for unexpected quote charactersCopyright © 1998-2015 Apache Software Foundation. All Rights Reserved.