Package csv
Class CSVFactory
java.lang.Object
csv.CSVFactory
public class CSVFactory
extends java.lang.Object
This factory returns correct reader and writer implementations
for given files.
- Author:
- RalphSchuster
-
Constructor Summary
Constructors Modifier Constructor Description protectedCSVFactory()Creates the factory and initializes. -
Method Summary
Modifier and Type Method Description static CSVFactorygetFactory()Returns the factory for rading/writing tables.java.lang.StringgetMimeType(java.io.File file)Returns the MIME type for the given file.AbstractStreamTableReadergetMimeTypeReader(java.lang.String mimeType)Returns a reader for the given MIME type.AbstractStreamTableWritergetMimeTypeWriter(java.lang.String mimeType)Returns a writer for the given MIME type.TableReadergetReader(java.io.File file)Returns the correct reader for the given file.TableReadergetReader(java.lang.String file)Returns the correct reader for the given file.AbstractStreamTableWritergetWriter(java.io.File file)Returns the correct reader for the given file.AbstractStreamTableWritergetWriter(java.lang.String file)Returns the correct reader for the given file.protected voidinit()Initializes the factory.protected voidinitReaderMap()Initializes the reader map.protected voidinitWriterMap()Initializes the writer map.voidregister(MimeTypeInfo mimeTypeInfo)Registers a new MIME type.
-
Constructor Details
-
CSVFactory
protected CSVFactory()Creates the factory and initializes.
-
-
Method Details
-
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
Registers a new MIME type.- Parameters:
mimeTypeInfo- the info to register
-
getReader
Returns the correct reader for the given file.- Parameters:
file- filename- Returns:
- reader class instance to be used
- Throws:
java.io.IOException- when the file cannot be read
-
getReader
Returns the correct reader for the given file.- Parameters:
file- file- Returns:
- reader class instance to be used
- Throws:
java.io.IOException- when the file cannot be read
-
getMimeTypeReader
Returns a reader for the given MIME type.- Parameters:
mimeType- MIME type- Returns:
- reader to be used
-
getWriter
Returns the correct reader for the given file.- Parameters:
file- filename- Returns:
- reader class instance to be used
- Throws:
java.io.IOException- when the file cannot be written
-
getWriter
Returns the correct reader for the given file.- Parameters:
file- file- Returns:
- reader class instance to be used
- Throws:
java.io.IOException- when the file cannot be written
-
getMimeTypeWriter
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
-