Copyright © 2008-2011 Ralph Schuster. All Rights Reserved.

csv.impl
Class AbstractStreamTableWriter

java.lang.Object
  extended by csv.impl.AbstractTableWriter
      extended by csv.impl.AbstractStreamTableWriter
All Implemented Interfaces:
TableWriter
Direct Known Subclasses:
CSVWriter, ExcelWriter, HtmlWriter, XmlWriter

public abstract class AbstractStreamTableWriter
extends AbstractTableWriter

An abstract implementation of TableWriter. This implementation is dedicated for I/O streams as underlying medium.

Author:
RalphSchuster

Constructor Summary
AbstractStreamTableWriter()
          Default Constructor.
AbstractStreamTableWriter(java.io.File file)
          Create a new instance from a file object.
AbstractStreamTableWriter(java.io.OutputStream out)
          Create a new instance from an existing OutputStream.
AbstractStreamTableWriter(java.lang.String file)
          Create a new instance froma file name.
 
Method Summary
 void close()
          Closes the writer and its underlying streams.
 java.io.OutputStream getOutputStream()
          Returns the underlying output stream
 java.io.PrintWriter getWriter()
          Returns a writer object for convinience.
 void setOutputStream(java.io.OutputStream out)
          Sets the underlying stream.
 
Methods inherited from class csv.impl.AbstractTableWriter
convert, convert, getRowCount, getTypeConversionHandler, incrementRowCount, init, printComment, printComment, registerTypeConversionHandler, unregisterTypeConversionHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface csv.TableWriter
printRow
 

Constructor Detail

AbstractStreamTableWriter

public AbstractStreamTableWriter()
Default Constructor.


AbstractStreamTableWriter

public AbstractStreamTableWriter(java.io.OutputStream out)
Create a new instance from an existing OutputStream.

Parameters:
out - - the stream to write to.

AbstractStreamTableWriter

public AbstractStreamTableWriter(java.io.File file)
                          throws java.io.IOException
Create a new instance from a file object.

Parameters:
file - - file to write data to.
Throws:
java.io.IOException - - when the file could not be created

AbstractStreamTableWriter

public AbstractStreamTableWriter(java.lang.String file)
                          throws java.io.IOException
Create a new instance froma file name.

Parameters:
file - - file to write data to.
Throws:
java.io.IOException - - when the file could not be created
Method Detail

setOutputStream

public void setOutputStream(java.io.OutputStream out)
Sets the underlying stream. This implementation throws an exception when the stream was already set.

Parameters:
out - the output stream to be used

getWriter

public java.io.PrintWriter getWriter()
Returns a writer object for convinience. The writer will be created only when required.

Returns:
the writer object

getOutputStream

public java.io.OutputStream getOutputStream()
Returns the underlying output stream

Returns:
the outputStream

close

public void close()
Closes the writer and its underlying streams.

Specified by:
close in interface TableWriter
Overrides:
close in class AbstractTableWriter

Copyright © 2008-2011 Ralph Schuster. All Rights Reserved.

Copyright © 2008-2011 Ralph Schuster. All Rights Reserved.