public final class CsvFileExtensions
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<java.lang.String> |
formatKommaSeperatedFileToList(java.io.File input,
java.lang.String encoding)
Reads every line from the File splits the data through a comma and puts them to the List.
|
static void |
formatToCSV(java.io.File input,
java.io.File output,
java.lang.String encoding)
Formats a file that has in every line one input-data into a csv-file.
|
static java.util.List<java.util.Map<java.lang.String,java.lang.String>> |
getCvsAsListMap(java.io.File input)
Gets the given cvs file as list of maps.
|
static java.util.List<java.util.Map<java.lang.String,java.lang.String>> |
getCvsAsListMap(java.io.File input,
java.lang.String encoding)
Gets the given cvs file as list of maps.
|
static java.lang.String[] |
getDataFromLine(java.lang.String line,
java.lang.String seperator)
Gets the data from line.
|
static java.lang.String[] |
getDataFromLine(java.lang.String line,
java.lang.String seperator,
boolean trim)
Gets the data from line.
|
static int |
getLineCountFromCsvFile(java.io.File file)
Gets the line count from csv file.
|
static java.util.List<java.lang.String> |
readDataFromCVSFileToList(java.io.File input,
int position,
boolean putFirstLine,
java.lang.String encoding)
Reads from a csv-file the field from the given position and puts them to the List.
|
static java.util.List<java.lang.String> |
readDataFromCVSFileToList(java.io.File input,
int position,
boolean putFirstLine,
java.lang.String splitChar,
java.lang.String encoding)
Reads from a csv-file the field from the given position and puts them to the List.
|
static java.util.Properties |
readFilelistToProperties(java.io.File input)
Read filelist to properties.
|
static java.util.List<java.lang.String> |
readFileToList(java.io.File file)
Reads every line from the given File into a List and returns the List.
|
static java.util.List<java.lang.String> |
readFileToList(java.io.File file,
java.lang.String encoding)
Reads every line from the given File into a List and returns the List.
|
static java.util.List<java.lang.String[]> |
readFileToList(java.io.File file,
java.lang.String seperator,
java.lang.String encoding)
Reads every line from the given File into a List of String arrays and returns the List.
|
static java.util.List<java.lang.String> |
readLinesInList(java.io.File input,
java.lang.String encoding)
Reads every line from the File and puts them to the List.
|
static java.lang.String[] |
sortData(java.io.File csvData,
java.lang.String encoding)
Read an csv-file and puts them in a String-array.
|
static void |
storeFilelistToProperties(java.io.File output,
java.io.File input,
java.lang.String comments)
Stores a komma seperated file to a properties object.
|
static void |
writeLines(java.io.File output,
java.util.Set<java.lang.String> values,
java.lang.String encoding)
Writes the toString() value of each item in a collection to the specified File line by line.
|
static void |
writeLinesToFile(java.util.Collection<java.lang.String> collection,
java.io.File output,
java.lang.String encoding)
Writes all the String-object in the collection into the given file.
|
public static java.util.List<java.lang.String> formatKommaSeperatedFileToList(java.io.File input,
java.lang.String encoding)
throws java.io.IOException
input - The File from where the input comes.encoding - The encoding from the file.java.io.IOException - Signals that an I/O exception has occurred.public static void formatToCSV(java.io.File input,
java.io.File output,
java.lang.String encoding)
throws java.io.IOException
input - The input-file to format. The current format from the file is every data in a
line.output - The file where the formatted data should be inserted.encoding - the encodingjava.io.IOException - When an io error occurs.public static java.util.List<java.util.Map<java.lang.String,java.lang.String>> getCvsAsListMap(java.io.File input)
throws java.io.IOException
input - the inputjava.io.IOException - Signals that an I/O exception has occurred.public static java.util.List<java.util.Map<java.lang.String,java.lang.String>> getCvsAsListMap(java.io.File input,
java.lang.String encoding)
throws java.io.IOException
input - the inputencoding - the encoding to readjava.io.IOException - Signals that an I/O exception has occurred.public static java.lang.String[] getDataFromLine(java.lang.String line,
java.lang.String seperator)
line - the lineseperator - the seperatorpublic static java.lang.String[] getDataFromLine(java.lang.String line,
java.lang.String seperator,
boolean trim)
line - the lineseperator - the seperatortrim - the trimpublic static int getLineCountFromCsvFile(java.io.File file)
throws java.io.IOException
file - the filejava.io.IOException - Signals that an I/O exception has occurred.public static java.util.List<java.lang.String> readDataFromCVSFileToList(java.io.File input,
int position,
boolean putFirstLine,
java.lang.String encoding)
throws java.io.IOException
input - The input-file.position - The position from the field.putFirstLine - Flag that tells if the first line will be put in the list.encoding - the encodingjava.io.IOException - When a io-problem occurs.public static java.util.List<java.lang.String> readDataFromCVSFileToList(java.io.File input,
int position,
boolean putFirstLine,
java.lang.String splitChar,
java.lang.String encoding)
throws java.io.IOException
input - The input-file.position - The position from the field.putFirstLine - Flag that tells if the first line will be put in the list.splitChar - the split charencoding - the encodingjava.io.IOException - When a io-problem occurs.public static java.util.Properties readFilelistToProperties(java.io.File input)
throws java.io.IOException
input - the inputjava.io.IOException - Signals that an I/O exception has occurred.public static java.util.List<java.lang.String> readFileToList(java.io.File file)
throws java.io.IOException
file - The file from where to read.java.io.IOException - When a io-problem occurs.public static java.util.List<java.lang.String> readFileToList(java.io.File file,
java.lang.String encoding)
throws java.io.IOException
file - The file from where to read.encoding - The encoding to read.java.io.IOException - When a io-problem occurs.public static java.util.List<java.lang.String[]> readFileToList(java.io.File file,
java.lang.String seperator,
java.lang.String encoding)
throws java.io.IOException
file - The file from where to read.seperator - the seperatorencoding - The encoding to read.java.io.IOException - Signals that an I/O exception has occurred.public static java.util.List<java.lang.String> readLinesInList(java.io.File input,
java.lang.String encoding)
throws java.io.IOException
input - The File from where the input comes.encoding - The encoding from the file.java.io.IOException - When a io-problem occurs.public static java.lang.String[] sortData(java.io.File csvData,
java.lang.String encoding)
throws java.io.FileNotFoundException,
java.io.IOException
csvData - The csv-file with the data.encoding - The encoding to read.java.io.FileNotFoundException - the file not found exceptionjava.io.IOException - When an io-error occurs.public static void storeFilelistToProperties(java.io.File output,
java.io.File input,
java.lang.String comments)
throws java.io.IOException
output - the outputinput - the inputcomments - the commentsjava.io.IOException - Signals that an I/O exception has occurred.public static void writeLines(java.io.File output,
java.util.Set<java.lang.String> values,
java.lang.String encoding)
throws java.io.IOException
output - The File where the values to save.values - The Set with the values to put into the file.encoding - The encoding from the file.java.io.IOException - When a io-problem occurs.public static void writeLinesToFile(java.util.Collection<java.lang.String> collection,
java.io.File output,
java.lang.String encoding)
throws java.io.IOException
collection - The collection with the String-object.output - The file where the String-object will be writing.encoding - The encoding from the file.java.io.IOException - Signals that an I/O exception has occurred.