Package org.codehaus.groovy.tools.groovydoc

# Class FileOutputTool

java.lang.Object
org.codehaus.groovy.tools.groovydoc.FileOutputTool

All Implemented Interfaces:
  `OutputTool`

public class FileOutputTool extends Object implements OutputTool
Writes generated documentation and copied resources to the file system.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FileOutputTool()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `copyResource(String srcPath, String dstPath)`
  Copy a resource file (doc-files/, snippet-files/ content) from `srcPath` to `dstPath`.
  `void`
  `makeOutputArea(String filename)`
  Ensures that the supplied output location exists.
  `void`
  `writeToOutput(String fileName, String text, String charset)`
  Writes rendered text to the supplied output file.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### FileOutputTool

    public FileOutputTool()

- ## Method Details

  - ### makeOutputArea

    public void makeOutputArea(String filename)
    Ensures that the supplied output location exists.
    Specified by:
      `makeOutputArea` in interface `OutputTool`
    Parameters:
      `filename` - the output directory or root path to prepare

  - ### writeToOutput

    public void writeToOutput(String fileName, String text, String charset) throws Exception
    Writes rendered text to the supplied output file.
    Specified by:
      `writeToOutput` in interface `OutputTool`
    Parameters:
      `fileName` - the file to write
      `text` - the rendered content
      `charset` - the character set to use when writing
    Throws:
      `Exception` - if the output cannot be written

  - ### copyResource

    public void copyResource(String srcPath, String dstPath) throws IOException
    Copy a resource file (doc-files/, snippet-files/ content) from `srcPath` to `dstPath`. Routed through the tool rather than calling `Files.copy` directly so that alternative tools (notably `MockOutputTool`) can intercept the side-effect.
    Specified by:
      `copyResource` in interface `OutputTool`
    Throws:
      `IOException`