at.tuwien.ifs.somtoolbox.apps.helper
Class SOMLibDataInfoGenerator

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.apps.helper.SOMLibDataInfoGenerator

public class SOMLibDataInfoGenerator
extends Object

Handles the normalization of vector files in SOMLib format. This class can be run in standalone mode taking two arguments, i.e. input and output file. If the input file is gzip-compressed, the output will also be written gzip-compressed. The .gz suffix has to be specified manually in order not to alter filenames to something other than intended by the user.

Created on Mar 16, 2004

Version:
$Id: SOMLibDataInfoGenerator.java 3589 2010-05-21 10:42:01Z mayer $
Author:
Michael Dittenbach

Constructor Summary
SOMLibDataInfoGenerator()
           
 
Method Summary
static void generateDataInfo(BufferedReader inReader, BufferedWriter outWriter, String baseDir, String removeDir)
          Static method taking a Buffered Reader and BufferedWriter as argument.
static void generateDataInfo(String inFileName, String outFileName, String baseDir, String removeDir)
          Static method taking input and output filename as argument.
private static char getSeparatorFromString(String path)
           
static void main(String[] args)
          Static method for standalone invocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SOMLibDataInfoGenerator

public SOMLibDataInfoGenerator()
Method Detail

main

public static void main(String[] args)
Static method for standalone invocation.

Parameters:
args - Usage: method-type input-filename output-filename

generateDataInfo

public static void generateDataInfo(String inFileName,
                                    String outFileName,
                                    String baseDir,
                                    String removeDir)
                             throws FileNotFoundException,
                                    IOException
Static method taking input and output filename as argument. File handling is done in this method and throws a FileNotFoundException if the input file can not be found and an IOException if some other file handling error occurs. If the input file is gzip-compressed, the output will also be written gzip-compressed. The .gz suffix has to be specified manually in order not to alter filenames to something other than intended by the user.

Parameters:
inFileName - Name of input file.
outFileName - Name of output file.
Throws:
FileNotFoundException - if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
IOException

generateDataInfo

public static void generateDataInfo(BufferedReader inReader,
                                    BufferedWriter outWriter,
                                    String baseDir,
                                    String removeDir)
Static method taking a Buffered Reader and BufferedWriter as argument. The method exits the program if the file format is corrupt. TODO: This should be weakened in future by throwing a SOMLibVectorFileFormatException.

Parameters:
inReader - BufferedReader reading the file continaing unnormalized vectors.
outWriter - BuffererWriter writing the normalized vector file.

getSeparatorFromString

private static char getSeparatorFromString(String path)
Parameters:
path - the path to calculate the separator of.
Returns:
the separator string, either '/' or '\\'