org.jSyncManager.API.Conduit.Tools

Class JSCSVCell

Implemented Interfaces:
java.io.Serializable

public class JSCSVCell
extends java.lang.Object
implements java.io.Serializable

A class for holding a single cell of data for a CSV delimited document. This class holds a single cell of data for a CSV delimited document. In the event that a cell contains more than one data item (byte[], int[], etc)   the value will be the concatenation of the encoded string values for all the data items. All binary values will be encoded using the "0x;" XML-compatible encoding.
See Also:
Serialized Form

Field Summary

static int
BOOLEAN
static int
BYTE
static int
BYTEARRAY
static int
CHAR
static int
CHARARRAY
static int
DATE
static int
DOUBLE
static int
DOUBLEARRAY
static int
FLOAT
static int
FLOATARRAY
static int
INT
static int
INTARRAY
static int
LONG
static int
LONGARRAY
static int
STRING
static int
STRINGARRAY

Constructor Summary

JSCSVCell()
Creates a new default empty instance of JSCSVCell.
JSCSVCell(GregorianCalendar dateentry)
Creates a new instance of JSCSVCell from a GregorianCalendar value.
JSCSVCell(String value)
Creates a new instance of JSCSVCell from the value given.
JSCSVCell(String value, int newtype)
Creates a new instance of JSCSVCell from an unparsed String and the datatype.
JSCSVCell(boolean value)
Creates a new instance of JSCSVCell from a boolean value.
JSCSVCell(byte value)
Creates a new instance of JSCSVCell from a byte value.
JSCSVCell(char value)
Creates a new instance of JSCSVCell from a char value.
JSCSVCell(double value)
Creates a new instance of JSCSVCell from a double value.
JSCSVCell(float value)
Creates a new instance of JSCSVCell from a float value.
JSCSVCell(int value)
Creates a new instance of JSCSVCell from a int value.
JSCSVCell(long value)
Creates a new instance of JSCSVCell from a long value.

Method Summary

String
escape(String in)
Escapes the value in the input string.
String
escape(boolean in)
Escapes the value in the input boolean.
String
escape(byte in)
Escapes the value in the input byte.
String
escape(char in)
Escapes the value in the input char.
String
escape(double in)
Escapes the value in the input double.
String
escape(float in)
Escapes the value in the input float.
String
escape(int in)
Escapes the value in the input integer.
String
escape(long in)
Escapes the value in the input long.
String
getDataDescr(int datatype)
Get Description string of given datatype index.
static String
getDefaultValueseparator()
Getter for the default value separator.
int
getType()
Get int value for property type.
String
getValue()
Getter for property value.
String
getValueseparator()
Getter for property valueseparator.
static void
setDefaultValueseparator(String valueseparator)
Setter for property valueseparator.
void
setType(int type)
Set int value of property type.
void
setValue(String value)
Setter for property value.
void
setValueseparator(String valueseparator)
Setter for property valueseparator.
boolean
unescapeBoolean()
Unescapes the value of the cell content to a boolean type.
byte
unescapeByte()
Unescapes the value of the current JSCSVCell.
static byte
unescapeByte(String input)
Unescapes the value of the given String.
char
unescapeChar()
Unescapes the value of the cell to a char type.
static char
unescapeChar(String input)
Unescapes the value of the given String to a char type.
double
unescapeDouble()
Unescapes the value of the cell content to a double type.
static double
unescapeDouble(String input)
Unescapes the value of the given String to a double type.
float
unescapeFloat()
Unescapes the value of the cell content to a float type.
static float
unescapeFloat(String input)
Unescapes the value of the given String to a float type.
int
unescapeInt()
Unescapes the value of the cell content to a int type.
static int
unescapeInt(String input)
Unescapes the value of the given String to a int type.
long
unescapeLong()
Unescapes the value of the cell content to a long type.
static long
unescapeLong(String input)
Unescapes the value of the given String to a long type.
String
unescapeString()
Unescapes the String value of the cell.
static String
unescapeString(String input)
Unescapes the String value given.
void
write(java.io.BufferedWriter output)
Writes the cell to the BufferedWriter output stream.

Field Details

BOOLEAN

public static final int BOOLEAN
Field Value:
14

BYTE

public static final int BYTE
Field Value:
2

BYTEARRAY

public static final int BYTEARRAY
Field Value:
9

CHAR

public static final int CHAR
Field Value:
1

CHARARRAY

public static final int CHARARRAY
Field Value:
8

DATE

public static final int DATE
Field Value:
15

DOUBLE

public static final int DOUBLE
Field Value:
6

DOUBLEARRAY

public static final int DOUBLEARRAY
Field Value:
13

FLOAT

public static final int FLOAT
Field Value:
4

FLOATARRAY

public static final int FLOATARRAY
Field Value:
12

INT

public static final int INT
Field Value:
3

INTARRAY

public static final int INTARRAY
Field Value:
10

LONG

public static final int LONG
Field Value:
5

LONGARRAY

public static final int LONGARRAY
Field Value:
11

STRING

public static final int STRING
Field Value:
0

STRINGARRAY

public static final int STRINGARRAY
Field Value:
7

Constructor Details

JSCSVCell

public JSCSVCell()
Creates a new default empty instance of JSCSVCell.

JSCSVCell

public JSCSVCell(GregorianCalendar dateentry)
Creates a new instance of JSCSVCell from a GregorianCalendar value.
Parameters:
dateentry - GregorianCalendar value for new JSCSVCell instance, encoded if necessary.

JSCSVCell

public JSCSVCell(String value)
Creates a new instance of JSCSVCell from the value given.
Parameters:
value - Value of JSCSVCell instance (encoded if necessary)

JSCSVCell

public JSCSVCell(String value,
                 int newtype)
Creates a new instance of JSCSVCell from an unparsed String and the datatype.
Parameters:
value - Value of JSCSVCell instance (encoded if binary)
newtype - Type of data contained in the cell

JSCSVCell

public JSCSVCell(boolean value)
Creates a new instance of JSCSVCell from a boolean value.
Parameters:
value - boolean value for new JSCSVCell instance, encoded if necessary.

JSCSVCell

public JSCSVCell(byte value)
Creates a new instance of JSCSVCell from a byte value.
Parameters:
value - byte value for new JSCSVCell instance, encoded if necessary.

JSCSVCell

public JSCSVCell(char value)
Creates a new instance of JSCSVCell from a char value.
Parameters:
value - char value for new JSCSVCell instance, encoded if necessary.

JSCSVCell

public JSCSVCell(double value)
Creates a new instance of JSCSVCell from a double value.
Parameters:
value - double value for new JSCSVCell instance, encoded if necessary.

JSCSVCell

public JSCSVCell(float value)
Creates a new instance of JSCSVCell from a float value.
Parameters:
value - float value for new JSCSVCell instance, encoded if necessary.

JSCSVCell

public JSCSVCell(int value)
Creates a new instance of JSCSVCell from a int value.
Parameters:
value - int value for new JSCSVCell instance, encoded if necessary.

JSCSVCell

public JSCSVCell(long value)
Creates a new instance of JSCSVCell from a long value.
Parameters:
value - long value for new JSCSVCell instance, encoded if necessary.

Method Details

escape

public String escape(String in)
Escapes the value in the input string.
Parameters:
in - String to be escaped
Returns:
String

escape

public String escape(boolean in)
Escapes the value in the input boolean.
Parameters:
in -
Returns:
String

escape

public String escape(byte in)
Escapes the value in the input byte.
Parameters:
in -
Returns:
String

escape

public String escape(char in)
Escapes the value in the input char.
Parameters:
in -
Returns:
String

escape

public String escape(double in)
Escapes the value in the input double.
Parameters:
in -
Returns:
String

escape

public String escape(float in)
Escapes the value in the input float.
Parameters:
in -
Returns:
String

escape

public String escape(int in)
Escapes the value in the input integer.
Parameters:
in -
Returns:
String

escape

public String escape(long in)
Escapes the value in the input long.
Parameters:
in -
Returns:
String

getDataDescr

public String getDataDescr(int datatype)
Get Description string of given datatype index.
Parameters:
datatype - Identifier of data type.
Returns:
String value of Data Description

getDefaultValueseparator

public static String getDefaultValueseparator()
Getter for the default value separator.
Returns:
Value of the default value separator.

getType

public int getType()
Get int value for property type.
Returns:
Value of property type.

getValue

public String getValue()
Getter for property value.
Returns:
String Value of property value.

getValueseparator

public String getValueseparator()
Getter for property valueseparator.
Returns:
Value of property valueseparator.

setDefaultValueseparator

public static void setDefaultValueseparator(String valueseparator)
Setter for property valueseparator.
Parameters:
valueseparator - New String value of property valueseparator.

setType

public void setType(int type)
Set int value of property type.
Parameters:
type - New int value of property type.

setValue

public void setValue(String value)
Setter for property value.
Parameters:
value - New String value of property value.

setValueseparator

public void setValueseparator(String valueseparator)
Setter for property valueseparator.
Parameters:
valueseparator - New String value of property valueseparator.

unescapeBoolean

public boolean unescapeBoolean()
            throws IllegalArgumentException
Unescapes the value of the cell content to a boolean type.
Returns:
boolean Boolean value of the cell

unescapeByte

public byte unescapeByte()
            throws NumberFormatException
Unescapes the value of the current JSCSVCell.
Returns:
byte byte value of the cell

unescapeByte

public static byte unescapeByte(String input)
            throws NumberFormatException
Unescapes the value of the given String.
Parameters:
input - String value to be handled.
Returns:
byte byte value of the cell

unescapeChar

public char unescapeChar()
Unescapes the value of the cell to a char type.
Returns:
char Char value of the cell

unescapeChar

public static char unescapeChar(String input)
Unescapes the value of the given String to a char type.
Parameters:
input - String value to be handled.
Returns:
char Char value of the cell

unescapeDouble

public double unescapeDouble()
            throws NumberFormatException
Unescapes the value of the cell content to a double type.
Returns:
double Double value of the cell

unescapeDouble

public static double unescapeDouble(String input)
            throws NumberFormatException
Unescapes the value of the given String to a double type.
Parameters:
input - String value to be handled.
Returns:
double Double value of the cell

unescapeFloat

public float unescapeFloat()
            throws NumberFormatException
Unescapes the value of the cell content to a float type.
Returns:
float Float value of the cell

unescapeFloat

public static float unescapeFloat(String input)
            throws NumberFormatException
Unescapes the value of the given String to a float type.
Parameters:
input - String value to be handled.
Returns:
float Float value of the cell

unescapeInt

public int unescapeInt()
            throws NumberFormatException
Unescapes the value of the cell content to a int type.
Returns:
Integer value of the cell

unescapeInt

public static int unescapeInt(String input)
            throws NumberFormatException
Unescapes the value of the given String to a int type.
Parameters:
input - String value to be handled.
Returns:
int Integer value of the cell

unescapeLong

public long unescapeLong()
            throws NumberFormatException
Unescapes the value of the cell content to a long type.
Returns:
long Long value of the cell

unescapeLong

public static long unescapeLong(String input)
            throws NumberFormatException
Unescapes the value of the given String to a long type.
Parameters:
input - String value to be handled.
Returns:
long Long value of the cell

unescapeString

public String unescapeString()
Unescapes the String value of the cell.
Returns:
String

unescapeString

public static String unescapeString(String input)
Unescapes the String value given.
Parameters:
input - String value to be handled.
Returns:
String

write

public void write(java.io.BufferedWriter output)
            throws IOException
Writes the cell to the BufferedWriter output stream.
Parameters:
output - BufferedOutput stream to be written to.