org.gcube.portlets.user.tdw.server.datasource.util
Class GridJSonWriter

java.lang.Object
  extended by org.gcube.portlets.user.tdw.server.datasource.util.GridJSonWriter
Direct Known Subclasses:
TableJSonWriter

public class GridJSonWriter
extends Object

Author:
"Federico De Faveri defaveri@isti.cnr.it"

Nested Class Summary
protected static class GridJSonWriter.JGridSonWriterState
           
 
Field Summary
protected  boolean dataDeclared
           
protected  int fieldsCount
           
protected  boolean firstColumn
           
protected  boolean firstField
           
protected  boolean firstRow
           
protected  boolean offsetDeclared
           
protected  int rowsCount
           
protected  GridJSonWriter.JGridSonWriterState state
           
protected  boolean totalLengthDeclared
           
protected  Writer writer
           
 
Constructor Summary
GridJSonWriter(Writer writer)
           
 
Method Summary
protected  void addKey(String key)
           
 void addValue(String id, Boolean value)
          Adds a new value in the row.
 void addValue(String id, Date value)
          Adds a new value in the row.
 void addValue(String id, Double value)
          Adds a new value in the row.
 void addValue(String id, Float value)
          Adds a new value in the row.
 void addValue(String id, Long value)
          Adds a new value in the row.
 void addValue(String id, String value)
          Adds a new value in the row.
protected  void addValueKey(String key)
           
protected  void appendQuoted(String value)
          Produce a string in double quotes with backslash sequences in all the right places.
protected  void checkFirstField()
           
protected  void checkState(GridJSonWriter.JGridSonWriterState expectedState)
           
 void close()
           
 void endData()
          Ends the data field.
 void endRow()
          Ends the data row.
 void setOffset(String offsetField, int offset)
           
 void setTotalLength(String totalLengthField, int length)
          Set the total length field.
 void startData(String dataField)
          Starts the data field.
 void startRow()
          Starts a new data row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

state

protected GridJSonWriter.JGridSonWriterState state

dataDeclared

protected boolean dataDeclared

totalLengthDeclared

protected boolean totalLengthDeclared

offsetDeclared

protected boolean offsetDeclared

writer

protected Writer writer

firstField

protected boolean firstField

firstRow

protected boolean firstRow

firstColumn

protected boolean firstColumn

rowsCount

protected int rowsCount

fieldsCount

protected int fieldsCount
Constructor Detail

GridJSonWriter

public GridJSonWriter(Writer writer)
               throws IOException
Throws:
IOException
Method Detail

checkState

protected void checkState(GridJSonWriter.JGridSonWriterState expectedState)

checkFirstField

protected void checkFirstField()
                        throws IOException
Throws:
IOException

startData

public void startData(String dataField)
               throws IOException
Starts the data field.

Parameters:
dataField - the data field name.
Throws:
IOException

startRow

public void startRow()
              throws IOException
Starts a new data row.

Throws:
IOException

addKey

protected void addKey(String key)
               throws IOException
Throws:
IOException

addValueKey

protected void addValueKey(String key)
                    throws IOException
Throws:
IOException

addValue

public void addValue(String id,
                     Boolean value)
              throws IOException
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.
Throws:
IOException

addValue

public void addValue(String id,
                     Date value)
              throws IOException
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.
Throws:
IOException

addValue

public void addValue(String id,
                     Double value)
              throws IOException
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.
Throws:
IOException

addValue

public void addValue(String id,
                     Float value)
              throws IOException
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.
Throws:
IOException

addValue

public void addValue(String id,
                     Long value)
              throws IOException
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.
Throws:
IOException

addValue

public void addValue(String id,
                     String value)
              throws IOException
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.
Throws:
IOException

endRow

public void endRow()
            throws IOException
Ends the data row.

Throws:
IOException

endData

public void endData()
             throws IOException
Ends the data field.

Throws:
IOException

setTotalLength

public void setTotalLength(String totalLengthField,
                           int length)
                    throws IOException
Set the total length field.

Parameters:
totalLengthField -
length -
Throws:
IOException

setOffset

public void setOffset(String offsetField,
                      int offset)
               throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException

appendQuoted

protected void appendQuoted(String value)
                     throws IOException
Produce a string in double quotes with backslash sequences in all the right places. A backslash will be inserted within
Parameters:
value - A String
Throws:
IOException


Copyright © 2013. All Rights Reserved.