|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dspace.app.bulkedit.DSpaceCSV
public class DSpaceCSV
Utility class to read and write CSV files
| Field Summary | |
|---|---|
protected static String |
escapedFieldSeparator
The field separator in an escaped form for using in regexs |
protected static String |
escpaedValueSeparator
The value separator in an escaped form for using in regexs |
protected static String |
fieldSeparator
The field separator (defaults to comma) |
protected static String |
valueSeparator
The value separator (defaults to double pipe '||') |
| Constructor Summary | |
|---|---|
DSpaceCSV(boolean exportAll)
Create a new instance of a CSV line holder |
|
DSpaceCSV(File f)
Create a new instance, reading the lines in from file |
|
| Method Summary | |
|---|---|
void |
addItem(Item i)
Add a DSpace item to the CSV file |
void |
addItem(String line)
Add an item to the CSV file, from a CSV line of elements |
ArrayList<DSpaceCSVLine> |
getCSVLines()
Get the lines in CSV holders |
String[] |
getCSVLinesAsStringArray()
Get the CSV lines as an array of CSV formatted strings |
static void |
main(String[] args)
Test main method to check the marshalling and unmarshalling of strings in and out of CSV format |
void |
save(String filename)
Save the CSV file to the given filename |
String |
toString()
Return the csv file as one long formatted string |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static String valueSeparator
protected static String escpaedValueSeparator
protected static String fieldSeparator
protected static String escapedFieldSeparator
| Constructor Detail |
|---|
public DSpaceCSV(boolean exportAll)
exportAll - Whether to export all metadata such as handles and provenance information
public DSpaceCSV(File f)
throws Exception
f - The file to read from
Exception - thrown if there is an error reading or processing the file| Method Detail |
|---|
public void addItem(Item i)
throws Exception
i - The DSpace item
Exception - if something goes wrong with adding the Item
public void addItem(String line)
throws Exception
line - The line of elements
Exception - Thrown if an error occurs when adding the itempublic ArrayList<DSpaceCSVLine> getCSVLines()
public String[] getCSVLinesAsStringArray()
public void save(String filename)
throws IOException
filename - The filename to save the CSV file to
IOException - Thrown if an error occurs when writing the filepublic String toString()
toString in class Object
public static void main(String[] args)
throws Exception
args - Not used
Exception - Thrown if something goes wrong
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||