calhoun.analysis.crf.io
Class ExtensionMapper

java.lang.Object
  extended by calhoun.analysis.crf.io.ExtensionMapper
All Implemented Interfaces:
FilenameMapper

public class ExtensionMapper
extends java.lang.Object
implements FilenameMapper

an implementation of FilenameMapper that changes file extensions or add a new file extension onto the source file. If the append property is set, the new extension will be added to the end of the existing filename. Otherwise, the existing file extension is replaced with the new extension.


Constructor Summary
ExtensionMapper()
           
 
Method Summary
 java.lang.String getExtension()
          the new extension to use in the mapped file.
 boolean isAppend()
          returns the value of the append property.
 java.io.File mapFilename(java.io.File source)
          Maps the source file name to a new name by altering the file extension.
 void setAppend(boolean append)
          set the value of the append property.
 void setExtension(java.lang.String extension)
          sets the extension.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensionMapper

public ExtensionMapper()
Method Detail

isAppend

public boolean isAppend()
returns the value of the append property. If true, the extension will be appended to the source filename. Otherwise, the existing extension will replaced with the new one. Default is false.

Returns:
the value of the append property.

setAppend

public void setAppend(boolean append)
set the value of the append property.

Parameters:
append - set to true if the extension should be appended to create the new filename.

getExtension

public java.lang.String getExtension()
the new extension to use in the mapped file. Must be set before {link #mapFilename} is called.

Returns:
the extension to use in the mapped file.

setExtension

public void setExtension(java.lang.String extension)
sets the extension.

Parameters:
extension - the extension to use in the mapped file.

mapFilename

public java.io.File mapFilename(java.io.File source)
Maps the source file name to a new name by altering the file extension. The new extension will either be added to the end of the existing filename or will replace the existing extension based on the value of the append property.

Specified by:
mapFilename in interface FilenameMapper
Parameters:
source - the input filename to use as the base for the mapping
Returns:
the destination filename
See Also:
FilenameMapper.mapFilename(java.io.File)