net.java.sen.util
Class CSVData

java.lang.Object
  extended by net.java.sen.util.CSVData

public class CSVData
extends Object

A class used to build a line of CSV data


Field Summary
protected  LinkedList<String> elements
          The values comprising the line
 
Constructor Summary
CSVData()
           
 
Method Summary
 void append(String element)
          Appends a value to the line
 void clear()
          Removes all values from the line
protected  String enquote(String string)
          Surrounds a string with double quotes if it contains either a double quote or a comma; replaces double quotes with a pair of double quotes
 void insert(int index, String element)
          Inserts a value into the line at a given index
 void remove(int index)
          Removes the value at the given index of the line
 void set(int index, String element)
          Replaces the value at the index of the line with a new value
 String toString()
          Returns the line of CSV data represented by this class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

elements

protected LinkedList<String> elements
The values comprising the line

Constructor Detail

CSVData

public CSVData()
Method Detail

append

public void append(String element)
Appends a value to the line

Parameters:
element - The element to be appended.

insert

public void insert(int index,
                   String element)
Inserts a value into the line at a given index

Parameters:
index - The index at which the value is to be inserted
element - The value to be inserted

remove

public void remove(int index)
Removes the value at the given index of the line

Parameters:
index - The index from which to remove a value

set

public void set(int index,
                String element)
Replaces the value at the index of the line with a new value

Parameters:
index - The index at which to replace a value
element - The value with which to replace

clear

public void clear()
Removes all values from the line


toString

public String toString()
Returns the line of CSV data represented by this class

Overrides:
toString in class Object
Returns:
The line of CSV data

enquote

protected String enquote(String string)
Surrounds a string with double quotes if it contains either a double quote or a comma; replaces double quotes with a pair of double quotes

Parameters:
string - The string to quote
Returns:
The quoted string


Copyright © 2012. All Rights Reserved.