|
||||||||||
| 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 ************** Important Note ************** This class has been made serializable, as it is stored in a Session. Is it wise to: a) be putting this into a user's session? b) holding an entire CSV upload in memory?
| Field Summary | |
|---|---|
protected static String |
escapedFieldSeparator
The field separator in an escaped form for using in regexs |
protected static String |
escapedValueSeparator
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,
Context c)
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 |
List<DSpaceCSVLine> |
getCSVLines()
Get the lines in CSV holders |
String[] |
getCSVLinesAsStringArray()
Get the CSV lines as an array of CSV formatted strings |
List<String> |
getHeadings()
Get the headings used in this CSV file |
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 escapedValueSeparator
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,
Context c)
throws Exception
f - The file to read fromc - The DSpace Context
Exception - thrown if there is an error reading or processing the file| Method Detail |
|---|
public final void addItem(Item i)
throws Exception
i - The DSpace item
Exception - if something goes wrong with adding the Item
public final void addItem(String line)
throws Exception
line - The line of elements
Exception - Thrown if an error occurs when adding the itempublic final List<DSpaceCSVLine> getCSVLines()
public final String[] getCSVLinesAsStringArray()
public final 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 List<String> getHeadings()
public final String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||