gov.nasa.pds.objectAccess
Class TableExporter

java.lang.Object
  extended by gov.nasa.pds.objectAccess.ObjectExporter
      extended by gov.nasa.pds.objectAccess.TableExporter
All Implemented Interfaces:
Exporter<Object>

public class TableExporter
extends ObjectExporter
implements Exporter<Object>

Defines methods for converting a table object to a desired export type.


Method Summary
 void convert(Object object, OutputStream outputStream)
          Converts the table object into the desired export type.
 void convert(OutputStream outputStream, int objectIndex)
          Converts the table object at the given objectIndex into the desired export type.
 Charset getDecoder()
          Returns the Charset to use for decoding the bytes.
 Charset getEncoder()
          Returns the Charset to use for encoding the bytes.
 String getExportType()
          Gets the desired export type.
 FieldDescription[] getTableFields(Object object)
          Gets the fields of a given table object.
 void setDecoder(String charsetName)
          Sets a character set to use for decoding the bytes.
 void setEncoder(String charsetName)
          Sets a character set to use for encoding the bytes.
 void setExportType(String exportType)
          Sets the desired export (output) type.
 
Methods inherited from class gov.nasa.pds.objectAccess.ObjectExporter
getObjectProvider, getObservationalFileArea, setObjectProvider, setObservationalFileArea
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.pds.objectAccess.Exporter
setObjectProvider, setObservationalFileArea
 

Method Detail

getTableFields

public FieldDescription[] getTableFields(Object object)
Gets the fields of a given table object.

Parameters:
object - the table object
Returns:
an array of field descriptions for the table

convert

public void convert(Object object,
                    OutputStream outputStream)
             throws IOException
Converts the table object into the desired export type. The valid table objects are TableCharacter, TableBinary and TableDelimited.

Specified by:
convert in interface Exporter<Object>
Parameters:
object - the table object to convert
outputStream - the output stream for the output file
Throws:
IOException - If an I/O error occurs

convert

public void convert(OutputStream outputStream,
                    int objectIndex)
             throws IOException
Converts the table object at the given objectIndex into the desired export type.

Specified by:
convert in interface Exporter<Object>
Parameters:
outputStream - the output stream for the output file
objectIndex - the index of the input table object
Throws:
IOException - If an I/O error occurs

getExportType

public String getExportType()
Gets the desired export type.

Returns:
the export type

setExportType

public void setExportType(String exportType)
Sets the desired export (output) type. Currently, "CSV" is the only supported type.

Specified by:
setExportType in interface Exporter<Object>
Parameters:
exportType - the export type

setDecoder

public void setDecoder(String charsetName)
Sets a character set to use for decoding the bytes.

Parameters:
charsetName - the name of a character set
Throws:
UnsupportedCharsetException - If name is not valid

getDecoder

public Charset getDecoder()
Returns the Charset to use for decoding the bytes.

Returns:
a character set

setEncoder

public void setEncoder(String charsetName)
Sets a character set to use for encoding the bytes.

Parameters:
charsetName - the name of a character set
Throws:
UnsupportedCharsetException - If name is not valid

getEncoder

public Charset getEncoder()
Returns the Charset to use for encoding the bytes.

Returns:
a character set


Copyright © 2014. All Rights Reserved.