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

csv
Class CSVFactory

java.lang.Object
  extended by csv.CSVFactory

public class CSVFactory
extends java.lang.Object

This factory returns correct reader and writer implementations for given files.

Author:
Ralph Schuster

Constructor Summary
protected CSVFactory()
          Creates the factory and initializes.
 
Method Summary
static CSVFactory getFactory()
          Returns the factory for rading/writing tables.
 java.lang.String getMimeType(java.io.File file)
          Returns the MIME type for the given file.
 TableReader getMimeTypeReader(java.lang.String mimeType)
          Returns a reader for the given MIME type.
 TableWriter getMimeTypeWriter(java.lang.String mimeType)
          Returns a writer for the given MIME type.
 TableReader getReader(java.io.File file)
          Returns the correct reader for the given file.
 TableReader getReader(java.lang.String file)
          Returns the correct reader for the given file.
 TableWriter getWriter(java.io.File file)
          Returns the correct reader for the given file.
 TableWriter getWriter(java.lang.String file)
          Returns the correct reader for the given file.
protected  void init()
          Initializes the factory.
protected  void initReaderMap()
          Initializes the reader map.
protected  void initWriterMap()
          Initializes the writer map.
 void register(MimeTypeInfo mimeTypeInfo)
          Registers a new MIME type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVFactory

protected CSVFactory()
Creates the factory and initializes.

Method Detail

getFactory

public static CSVFactory getFactory()
Returns the factory for rading/writing tables.

Returns:
factory factory object (singleton)

init

protected void init()
Initializes the factory.


initReaderMap

protected void initReaderMap()
Initializes the reader map.


initWriterMap

protected void initWriterMap()
Initializes the writer map.


register

public void register(MimeTypeInfo mimeTypeInfo)
Registers a new MIME type.

Parameters:
mimeTypeInfo - the info to register

getReader

public TableReader getReader(java.lang.String file)
                      throws java.io.IOException
Returns the correct reader for the given file.

Parameters:
file - filename
Returns:
reader class instance to be used
Throws:
java.io.IOException

getReader

public TableReader getReader(java.io.File file)
                      throws java.io.IOException
Returns the correct reader for the given file.

Parameters:
file - file
Returns:
reader class instance to be used
Throws:
java.io.IOException

getMimeTypeReader

public TableReader getMimeTypeReader(java.lang.String mimeType)
Returns a reader for the given MIME type.

Parameters:
mimeType - MIME type
Returns:
reader to be used

getWriter

public TableWriter getWriter(java.lang.String file)
                      throws java.io.IOException
Returns the correct reader for the given file.

Parameters:
file - filename
Returns:
reader class instance to be used
Throws:
java.io.IOException

getWriter

public TableWriter getWriter(java.io.File file)
                      throws java.io.IOException
Returns the correct reader for the given file.

Parameters:
file - file
Returns:
reader class instance to be used
Throws:
java.io.IOException

getMimeTypeWriter

public TableWriter getMimeTypeWriter(java.lang.String mimeType)
Returns a writer for the given MIME type.

Parameters:
mimeType - MIME type
Returns:
writer to be used

getMimeType

public java.lang.String getMimeType(java.io.File file)
Returns the MIME type for the given file.

Parameters:
file - file to check
Returns:
MIME type of file

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

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