|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tranche.tasks.CSVFile
public class CSVFile
Abstracts a comma-separated value file. Use the reader to build.
| Constructor Summary | |
|---|---|
CSVFile(java.io.File file,
java.util.List<java.lang.String> legend,
java.util.List<java.util.Map<java.lang.String,java.lang.String>> records)
|
|
| Method Summary | |
|---|---|
boolean |
appendRecord(java.util.Map<java.lang.String,java.lang.String> record)
Appends a record to CSVFile representation. |
CSVFile |
clone()
Returns a clone (deep copy). |
boolean |
equals(java.lang.Object o)
Returns whether this CSV File is the same as the given CSV File. |
java.lang.Object |
getEntry(int index,
java.lang.String key)
Returns an entry within a particular record using a key. |
java.io.File |
getFile()
Returnst the CSV file. |
java.util.List<java.lang.String> |
getLegend()
Returns the list of keys in order of appearance in the file. |
java.util.Map<java.lang.String,java.lang.String> |
getRecord(int index)
Returns a record found in a row. |
java.util.List<java.util.Map<java.lang.String,java.lang.String>> |
getRecords()
Returns the records of the CSV file. |
void |
printContents(java.io.PrintStream out)
Prints the CSV file to the given output stream. |
java.util.Map<java.lang.String,java.lang.String> |
removeRecord(int index)
Remove the record with the given index. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CSVFile(java.io.File file,
java.util.List<java.lang.String> legend,
java.util.List<java.util.Map<java.lang.String,java.lang.String>> records)
file - the file receivedlegend - the list of keys receivedrecords - the records received| Method Detail |
|---|
public java.io.File getFile()
Returnst the CSV file.
public java.util.List<java.lang.String> getLegend()
Returns the list of keys in order of appearance in the file.
public java.util.Map<java.lang.String,java.lang.String> getRecord(int index)
Returns a record found in a row. The rows are zero-indexed starting with the first valid record and incremented by subsequent valid records.
index - the index of the desired record
public java.util.Map<java.lang.String,java.lang.String> removeRecord(int index)
Remove the record with the given index.
index -
public boolean appendRecord(java.util.Map<java.lang.String,java.lang.String> record)
Appends a record to CSVFile representation. To store, you must rewrite the file using the writer.
record - the record
true if the record is appended;
false otherwise
public java.lang.Object getEntry(int index,
java.lang.String key)
Returns an entry within a particular record using a key. The list of keys are available as the legend.
index - the index of the record seekedkey - the key used to retrieve an entry within the seeked record
public java.util.List<java.util.Map<java.lang.String,java.lang.String>> getRecords()
Returns the records of the CSV file.
public CSVFile clone()
Returns a clone (deep copy). Useful for:
clone in class java.lang.Objectpublic void printContents(java.io.PrintStream out)
Prints the CSV file to the given output stream.
out - the output streampublic boolean equals(java.lang.Object o)
Returns whether this CSV File is the same as the given CSV File.
equals in class java.lang.Objecto -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||