public class DSpaceCSV
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
authoritySeparator
The authority separator (defaults to double colon '::')
|
protected static java.lang.String |
escapedAuthoritySeparator
The authority separator in an escaped form for using in regexes
|
protected static java.lang.String |
escapedFieldSeparator
The field separator in an escaped form for using in regexes
|
protected static java.lang.String |
escapedValueSeparator
The value separator in an escaped form for using in regexes
|
protected static java.lang.String |
fieldSeparator
The field separator (defaults to comma)
|
protected static java.lang.String |
valueSeparator
The value separator (defaults to double pipe '||')
|
| Constructor and Description |
|---|
DSpaceCSV(boolean exportAll)
Create a new instance of a CSV line holder
|
DSpaceCSV(java.io.File f,
Context c)
Create a new instance, reading the lines in from file
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(Item i)
Add a DSpace item to the CSV file
|
void |
addItem(java.lang.String line)
Add an item to the CSV file, from a CSV line of elements
|
java.util.List<DSpaceCSVLine> |
getCSVLines()
Get the lines in CSV holders
|
java.lang.String[] |
getCSVLinesAsStringArray()
Get the CSV lines as an array of CSV formatted strings
|
java.util.List<java.lang.String> |
getHeadings()
Get the headings used in this CSV file
|
boolean |
hasActions()
Decide if this CSV file has an 'action' (case-dependent!) header.
|
void |
save(java.lang.String filename)
Save the CSV file to the given filename
|
java.lang.String |
toString()
Return the csv file as one long formatted string
|
protected static java.lang.String valueSeparator
protected static java.lang.String escapedValueSeparator
protected static java.lang.String fieldSeparator
protected static java.lang.String escapedFieldSeparator
protected static java.lang.String authoritySeparator
protected static java.lang.String escapedAuthoritySeparator
public DSpaceCSV(boolean exportAll)
exportAll - Whether to export all metadata such as handles and provenance informationpublic DSpaceCSV(java.io.File f,
Context c)
throws java.lang.Exception
f - The file to read fromc - The DSpace Contextjava.lang.Exception - thrown if there is an error reading or processing the filepublic boolean hasActions()
public final void addItem(Item i) throws java.lang.Exception
i - The DSpace itemjava.lang.Exception - if something goes wrong with adding the Itempublic final void addItem(java.lang.String line)
throws java.lang.Exception
line - The line of elementsjava.lang.Exception - Thrown if an error occurs when adding the itempublic final java.util.List<DSpaceCSVLine> getCSVLines()
public final java.lang.String[] getCSVLinesAsStringArray()
public final void save(java.lang.String filename)
throws java.io.IOException
filename - The filename to save the CSV file tojava.io.IOException - Thrown if an error occurs when writing the filepublic java.util.List<java.lang.String> getHeadings()
public final java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2013 DuraSpace. All Rights Reserved.