Package gov.nasa.pds.objectAccess
Class TableWriter
- java.lang.Object
- 
- gov.nasa.pds.objectAccess.TableWriter
 
- 
 public class TableWriter extends java.lang.ObjectTheTableWriterclass is used for writing fixed-width text, fixed-width binary and delimited data files.
- 
- 
Constructor SummaryConstructors Constructor Description TableWriter(java.lang.Object table, java.io.OutputStream outputStream)Creates an instance ofTableWriterfor writing to a fixed-width text or binary data file and uses "US-ASCII" character set name for encoding.TableWriter(java.lang.Object table, java.io.OutputStream outputStream, java.lang.String charsetName)Creates an instance ofTableWriterfor writing to a fixed-width text or binary data file.TableWriter(java.lang.Object table, java.io.Writer writer)Creates an instance ofTableWriterfor writing to a delimited data file.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this table writer which may no longer be used for writing records.TableRecordcreateRecord()Creates a record for adding data.voidflush()Flushes the output stream or writer.voidwrite(TableRecord record)Writes the table record to the output stream or writer.
 
- 
- 
- 
Constructor Detail- 
TableWriterpublic TableWriter(java.lang.Object table, java.io.OutputStream outputStream, java.lang.String charsetName) throws java.nio.charset.UnsupportedCharsetException, InvalidTableExceptionCreates an instance ofTableWriterfor writing to a fixed-width text or binary data file. For fixed-width text file, 'carriage return + line feed' is used for record delimiter.- Parameters:
- table- a table object
- outputStream- an output stream
- charsetName- the charset name to use for encoding the bytes.
- Throws:
- java.nio.charset.UnsupportedCharsetException
- InvalidTableException
 
 - 
TableWriterpublic TableWriter(java.lang.Object table, java.io.OutputStream outputStream) throws InvalidTableExceptionCreates an instance ofTableWriterfor writing to a fixed-width text or binary data file and uses "US-ASCII" character set name for encoding. For fixed-width text file, 'carriage return + line feed' is used for record delimiter.- Parameters:
- table- a table object
- outputStream- an output stream
- Throws:
- InvalidTableException
 
 - 
TableWriterpublic TableWriter(java.lang.Object table, java.io.Writer writer) throws InvalidTableExceptionCreates an instance ofTableWriterfor writing to a delimited data file. It uses 'carriage return + line feed' for record delimiter.- Parameters:
- table- a table object
- writer- a writer object
- Throws:
- InvalidTableException
 
 
- 
 - 
Method Detail- 
createRecordpublic TableRecord createRecord() Creates a record for adding data.- Returns:
- an instance of TableRecord
 
 - 
writepublic void write(TableRecord record) throws java.io.IOException Writes the table record to the output stream or writer.- Parameters:
- record- the- TableRecordobject
- Throws:
- java.io.IOException
 
 - 
flushpublic void flush() throws java.io.IOExceptionFlushes the output stream or writer.- Throws:
- java.io.IOException
 
 - 
closepublic void close() throws java.io.IOExceptionCloses this table writer which may no longer be used for writing records.- Throws:
- java.io.IOException
 
 
- 
 
-