jSyncManager

org.jSyncManager.API.Protocol.Util
Class JSCSVCell

java.lang.Object
  |
  +--org.jSyncManager.API.Protocol.Util.JSCSVCell
All 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.

Version:
$Revision: 1.11 $
Author:
David A. Bartmess <dingodave@edingo.net>
Last modified by: $Author: yaztromo $ on $Date: 2003/05/08 04:34:21 $.
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(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(java.util.GregorianCalendar dateentry)
          Creates a new instance of JSCSVCell from a GregorianCalendar 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.
JSCSVCell(java.lang.String value)
          Creates a new instance of JSCSVCell from the value given.
JSCSVCell(java.lang.String value, int newtype)
          Creates a new instance of JSCSVCell from an unparsed String and the datatype.
 
Method Summary
 java.lang.String escape(boolean in)
          Escapes the value in the input boolean.
 java.lang.String escape(byte in)
          Escapes the value in the input byte.
 java.lang.String escape(char in)
          Escapes the value in the input char.
 java.lang.String escape(double in)
          Escapes the value in the input double.
 java.lang.String escape(float in)
          Escapes the value in the input float.
 java.lang.String escape(int in)
          Escapes the value in the input integer.
 java.lang.String escape(long in)
          Escapes the value in the input long.
 java.lang.String escape(java.lang.String in)
          Escapes the value in the input string.
 java.lang.String getDataDescr(int datatype)
          Get Description string of given datatype index.
 int getType()
          Get int value for property type.
 java.lang.String getValue()
          Getter for property value.
static java.lang.String getValueseparator()
          Getter for property valueseparator.
 void setType(int type)
          Set int value of property type.
 void setValue(java.lang.String value)
          Setter for property value.
 void setValueseparator(java.lang.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(java.lang.String input)
          Unescapes the value of the given String.
 char unescapeChar()
          Unescapes the value of the cell to a char type.
static char unescapeChar(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String input)
          Unescapes the value of the given String to a long type.
 java.lang.String unescapeString()
          Unescapes the String value of the cell.
static java.lang.String unescapeString(java.lang.String input)
          Unescapes the String value given.
 void write(java.io.BufferedWriter output)
          Writes the cell to the BufferedWriter output stream.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRING

public static final int STRING

CHAR

public static final int CHAR

BYTE

public static final int BYTE

INT

public static final int INT

FLOAT

public static final int FLOAT

LONG

public static final int LONG

DOUBLE

public static final int DOUBLE

STRINGARRAY

public static final int STRINGARRAY

CHARARRAY

public static final int CHARARRAY

BYTEARRAY

public static final int BYTEARRAY

INTARRAY

public static final int INTARRAY

LONGARRAY

public static final int LONGARRAY

FLOATARRAY

public static final int FLOATARRAY

DOUBLEARRAY

public static final int DOUBLEARRAY

BOOLEAN

public static final int BOOLEAN

DATE

public static final int DATE
Constructor Detail

JSCSVCell

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

JSCSVCell

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

JSCSVCell

public JSCSVCell(java.lang.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(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(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(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.

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(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(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(java.util.GregorianCalendar dateentry)
Creates a new instance of JSCSVCell from a GregorianCalendar value.
Parameters:
value - GregorianCalendar value for new JSCSVCell instance, encoded if necessary.
Method Detail

write

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

escape

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

escape

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

escape

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

escape

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

escape

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

escape

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

escape

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

escape

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

unescapeString

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

unescapeString

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

unescapeByte

public byte unescapeByte()
                  throws java.lang.NumberFormatException
Unescapes the value of the current JSCSVCell.
Returns:
byte byte value of the cell
Throws:
java.lang.NumberFormatException - If the cell value is not a numerical value.

unescapeByte

public static byte unescapeByte(java.lang.String input)
                         throws java.lang.NumberFormatException
Unescapes the value of the given String.
Parameters:
input - String value to be handled.
Returns:
byte byte value of the cell
Throws:
java.lang.NumberFormatException - If the cell value is not a numerical value.

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(java.lang.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

unescapeInt

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

unescapeInt

public static int unescapeInt(java.lang.String input)
                       throws java.lang.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
Throws:
java.lang.NumberFormatException -  

unescapeLong

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

unescapeLong

public static long unescapeLong(java.lang.String input)
                         throws java.lang.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
Throws:
java.lang.NumberFormatException -  

unescapeFloat

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

unescapeFloat

public static float unescapeFloat(java.lang.String input)
                           throws java.lang.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
Throws:
java.lang.NumberFormatException -  

unescapeDouble

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

unescapeDouble

public static double unescapeDouble(java.lang.String input)
                             throws java.lang.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
Throws:
java.lang.NumberFormatException -  

unescapeBoolean

public boolean unescapeBoolean()
                        throws java.lang.IllegalArgumentException
Unescapes the value of the cell content to a boolean type.
Returns:
boolean Boolean value of the cell
Throws:
java.lang.IllegalArgumentException - If the value of the cell content is not "true" or "false".

getValue

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

setValue

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

getType

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

setType

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

getDataDescr

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

getValueseparator

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

setValueseparator

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

jSyncManager

Copyright (c) 1999 - 2003 Brad BARCLAY and others. All Rights Reserved.