org.openspml.v2.examples.nvpstore.csvdb
Class CSVFormatter

java.lang.Object
  extended byorg.openspml.v2.examples.nvpstore.csvdb.CSVFormatter

public class CSVFormatter
extends java.lang.Object

This will format the a string using the information in the NVPObjectDef about NVPs, their cardinality, and type.

The values are encoded if they contain ',' characters... ',' is escaped to a \, pair. Backslash (because of the comma escaping) is also escaped, so \ becomes \\.

Multiple values are bracketed and their individual values are escaped as above.

We don't support binary, but if you have a Base64 encoder implementation, it's easy to add.

Author(s): Kent Spaulding (kent.spaulding@sun.com)


Field Summary
static java.lang.String code_id
           
 
Method Summary
 java.lang.String format(java.util.Map map)
          Change should contain recordPath==>valueToFormat
 java.lang.String[] getHeader()
           
 java.util.Map unformat(java.lang.String line)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values
Method Detail

getHeader

public java.lang.String[] getHeader()

format

public java.lang.String format(java.util.Map map)
Change should contain recordPath==>valueToFormat

Parameters:
map - values to write
Returns:
the string to write

unformat

public java.util.Map unformat(java.lang.String line)


Copyright © Sun Microsystems, Inc. All Rights Reserved.