2.17.2: 2011-06-17

net.sf.basedb.util.bfs
Class GenericBaseDataWriterFactory<T>

java.lang.Object
  extended by net.sf.basedb.util.bfs.AbstractDataWriterFactory<T>
      extended by net.sf.basedb.util.bfs.GenericBaseDataWriterFactory<T>
All Implemented Interfaces:
DataWriterFactory<T>

public class GenericBaseDataWriterFactory<T>
extends AbstractDataWriterFactory<T>

Generic implementation of a data writer factory that create files in the BASE file system.

Version:
2.15
Author:
Nicklas
Last modified
$Date: 2010-01-12 14:21:49 +0100 (Tue, 12 Jan 2010) $

Field Summary
private  DbControl dc
           
private  Directory dir
           
 
Constructor Summary
GenericBaseDataWriterFactory(DbControl dc, Directory dir, FilenameGenerator<T> filenameGenerator)
          Create a new factory that creates files in the given directory.
 
Method Summary
protected  OutputStream getOutputStream(String filename)
          Create a new file in the data directory with the given file name.
protected  void setFileProperties(File file)
          Set file properties on the newly created file object.
 
Methods inherited from class net.sf.basedb.util.bfs.AbstractDataWriterFactory
createDataWriter, isUnique
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dc

private final DbControl dc

dir

private final Directory dir
Constructor Detail

GenericBaseDataWriterFactory

public GenericBaseDataWriterFactory(DbControl dc,
                                    Directory dir,
                                    FilenameGenerator<T> filenameGenerator)
                             throws IOException
Create a new factory that creates files in the given directory. The directory should already exist.

Parameters:
dir - The directory to create files in
Throws:
IOException
Method Detail

getOutputStream

protected OutputStream getOutputStream(String filename)
                                throws IOException
Create a new file in the data directory with the given file name.

Specified by:
getOutputStream in class AbstractDataWriterFactory<T>
Throws:
IOException - If there is a problem creating the file

setFileProperties

protected void setFileProperties(File file)
Set file properties on the newly created file object. The default implementation sets the character set to UTF-8 and the MIME type to text/plain. A subclass may override this method to set other properties.

Parameters:
file - The new file

2.17.2: 2011-06-17