org.idoox.wasp.tools.common
Class FileCompilerIO

java.lang.Object
  extended byorg.idoox.wasp.tools.common.FileCompilerIO
All Implemented Interfaces:
CompilerIO

public class FileCompilerIO
extends java.lang.Object
implements CompilerIO

A basic implementation of the interface CompilerIO.
Creates a new files (if any file exist, overwrites it) with a given name in a directory set in constructor. If the target directory doesn't exist, it is created.

Since:
4.5
Component:
Core

Field Summary
protected  java.io.File targetDirectory
           
 
Constructor Summary
FileCompilerIO()
          Creates new instance of FileCompilerIO with the target directory set to the actual directory.
FileCompilerIO(java.io.File targetDirectory)
          Creates new instance of FileCompilerIO with the specified target directory.
FileCompilerIO(java.lang.String targetDirectory)
          Creates new instance of FileCompilerIO with the specified target directory.
 
Method Summary
 java.io.PrintWriter getWriter(java.lang.String relativePath)
          Creates a new file and returns a PrintWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targetDirectory

protected java.io.File targetDirectory
Constructor Detail

FileCompilerIO

public FileCompilerIO()
Creates new instance of FileCompilerIO with the target directory set to the actual directory.


FileCompilerIO

public FileCompilerIO(java.lang.String targetDirectory)
Creates new instance of FileCompilerIO with the specified target directory.

Parameters:
targetDirectory - a target directory to which paths relate

FileCompilerIO

public FileCompilerIO(java.io.File targetDirectory)
Creates new instance of FileCompilerIO with the specified target directory.

Parameters:
targetDirectory - a target directory to which paths relate
Method Detail

getWriter

public java.io.PrintWriter getWriter(java.lang.String relativePath)
                              throws java.io.IOException
Creates a new file and returns a PrintWriter. Using the PrintWriter the content of the file is written.

Specified by:
getWriter in interface CompilerIO
Parameters:
relativePath - a file's path to create
Returns:
a PrintWriter related to a file, using the PrintWriter the content of the file is written
Throws:
java.io.IOException - if any exception occures