LiveGraph
data visualisation and analysis framework

org.LiveGraph.dataFile.write
Class DataStreamWriterFactory

java.lang.Object
  extended by org.LiveGraph.dataFile.write.DataStreamWriterFactory

public class DataStreamWriterFactory
extends java.lang.Object

This class provides static convenience methods for creating dedicated data stream writers. Given just a directory on the local hard drive, this class can automatically choose a descriptive and unique name for a data file and return an appropriate DataStreamWriter object.

An example of how to use this class can be found in LiveGraphDemo.

This product includes software developed by the LiveGraph project and its contributors.
(http://www.live-graph.org)
Copyright (c) 2007 G. Paperin.
All rights reserved.

File: DataStreamWriterFactory.java

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following terms and conditions are met:

1. Redistributions of source code must retain the above acknowledgement of the LiveGraph project and its web-site, the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above acknowledgement of the LiveGraph project and its web-site, the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software or any derived software must display the following acknowledgement:
This product includes software developed by the LiveGraph project and its contributors.
(http://www.live-graph.org)

4. All advertising materials distributed in form of HTML pages or any other technology permitting active hyper-links that mention features or use of this software or any derived software must display the acknowledgment specified in condition 3 of this agreement, and in addition, include a visible and working hyper-link to the LiveGraph homepage (http://www.live-graph.org).

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version:
"1.1.1"
Author:
Greg Paperin (http://www.paperin.org)

Field Summary
static java.lang.String defaultFileExtension
          Data file extension used if no other specified.
 
Constructor Summary
DataStreamWriterFactory()
           
 
Method Summary
static DataStreamWriter createDataWriter(java.lang.String dataFileDir, java.lang.String dataFileName)
          Creates a new DataStreamWriter object for a unique file located in the specified directory.
static DataStreamWriter createDataWriter(java.lang.String dataFileDir, java.lang.String dataFileName, java.lang.String dataFileExt)
          Creates a new DataStreamWriter object for a unique file located in the specified directory.
static java.io.File getUniqueDataFile(java.lang.String dataFileDir, java.lang.String dataFileName, java.lang.String dataFileExt)
          Constructs a unique file name for a file located in the specified directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultFileExtension

public static final java.lang.String defaultFileExtension
Data file extension used if no other specified.

See Also:
Constant Field Values
Constructor Detail

DataStreamWriterFactory

public DataStreamWriterFactory()
Method Detail

createDataWriter

public static DataStreamWriter createDataWriter(java.lang.String dataFileDir,
                                                java.lang.String dataFileName)
Creates a new DataStreamWriter object for a unique file located in the specified directory. The file will be named on the basis of the specified name and the current date and time.
The file name will be constructed according to the following pattern:
dataFileName.YY.MM.DD-HH.MM.SS."dat"

Parameters:
dataFileDir - The local folder in thich the file will be located.
dataFileName - The basis for the file name.
Returns:
A DataStreamWriter for the file with the name described above.

createDataWriter

public static DataStreamWriter createDataWriter(java.lang.String dataFileDir,
                                                java.lang.String dataFileName,
                                                java.lang.String dataFileExt)
Creates a new DataStreamWriter object for a unique file located in the specified directory. The file will be named on the basis of the specified name, the specified extension and the current date and time.
The file name will be constructed according to the following pattern:
dataFileName.YY.MM.DD-HH.MM.SS.dataFileExt

Parameters:
dataFileDir - The local folder in thich the file will be located.
dataFileName - The basis for the file name.
dataFileExt - The extension for the file name.
Returns:
A DataStreamWriter for the file with the name described above.

getUniqueDataFile

public static java.io.File getUniqueDataFile(java.lang.String dataFileDir,
                                             java.lang.String dataFileName,
                                             java.lang.String dataFileExt)
Constructs a unique file name for a file located in the specified directory. The file will be named on the basis of the specified name, the specified extension and the current date and time.
The file name will be constructed according to the following pattern:
dataFileName.YY.MM.DD-HH.MM.SS.dataFileExt
If that file already exists, the file name will be adjusted to
dataFileName.YY.MM.DD-HH.MM.SS(1).dataFileExt,
dataFileName.YY.MM.DD-HH.MM.SS(2).dataFileExt,
and so on until the file does not already exist.

Parameters:
dataFileDir - The local folder in thich the file will be located.
dataFileName - The basis for the file name.
dataFileExt - The extension for the file name.
Returns:
A file object describing a file with the name as specified above.

LiveGraph
data visualisation and analysis framework