|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.jaulp.file.csv.CsvFileUtils
public class CsvFileUtils
Utility class for the use of cvs-files.
| Constructor Summary | |
|---|---|
CsvFileUtils()
|
|
| Method Summary | |
|---|---|
static void |
closeWriter(java.io.Writer writer)
Deprecated. Use instead StreamUtils.closeWriter( Writer ). |
static java.util.List |
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.lang.String |
putQuotesToString(java.lang.String s)
Deprecated. Use instead StringUtils.putQuotesToString( String ). |
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> |
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 |
removeQuotesFromString(java.lang.String s)
Deprecated. Use instead StringUtils.removeQuotesFromString(String). |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CsvFileUtils()
| Method Detail |
|---|
@Deprecated public static void closeWriter(java.io.Writer writer)
writer - The Writer to close.
public static java.util.List formatKommaSeperatedFileToList(java.io.File input,
java.lang.String encoding)
input - The File from where the input comes.encoding - The encoding from the file.
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.
java.io.IOException - When an io error occurs.@Deprecated public static java.lang.String putQuotesToString(java.lang.String s)
s - The String to handle.
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.
java.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.
java.io.IOException - When a io-problem occurs.
public static java.util.Properties readFilelistToProperties(java.io.File input)
throws java.io.IOException
input - the input
java.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> 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.@Deprecated public static java.lang.String removeQuotesFromString(java.lang.String s)
s - The String to handle.
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.
FileDoesNotExistException - When the File is not found.
java.io.IOException - When an io-error occurs.
java.io.FileNotFoundException
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 comments
java.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)
collection - The collection with the String-object.output - The file where the String-object will be writing.encoding - The encoding from the file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||