de.unkrig.commons.file.filetransformation
Interface FileTransformer

All Known Implementing Classes:
DirectoryTransformer, FileContentsTransformer, ProxyFileTransformer, SelectiveFileTransformer

public interface FileTransformer

See Also:
transform(String, File, File, Mode)

Nested Class Summary
static class FileTransformer.Mode
           
 
Field Summary
static java.lang.RuntimeException NOT_IDENTICAL
          Thrown by transform(String, File, File, FileTransformer.Mode.CHECK); indicates that the output created by transform(String, File, File, FileTransformer.Mode.TRANSFORM) would be identical with the input.
static java.lang.Runnable THROW_NOT_IDENTICAL
          A Runnable that simply throws NOT_IDENTICAL.
 
Method Summary
 void transform(java.lang.String path, java.io.File in, java.io.File out, FileTransformer.Mode mode)
          Creates the file out, based on the file in.
 

Field Detail

NOT_IDENTICAL

static final java.lang.RuntimeException NOT_IDENTICAL
Thrown by transform(String, File, File, FileTransformer.Mode.CHECK); indicates that the output created by transform(String, File, File, FileTransformer.Mode.TRANSFORM) would be identical with the input.


THROW_NOT_IDENTICAL

static final java.lang.Runnable THROW_NOT_IDENTICAL
A Runnable that simply throws NOT_IDENTICAL.

Method Detail

transform

void transform(java.lang.String path,
               java.io.File in,
               java.io.File out,
               FileTransformer.Mode mode)
               throws java.io.IOException
Creates the file out, based on the file in. Iff in.equals(out) ('in-place transformation'), then the original file remains unchanged, is modified, or replaced with a new file.

The precise contract is as follows:

Parameters:
path - A text designating the input file; typically, but not necessarily identical with in.getPath()
Throws:
java.lang.RuntimeException - NOT_IDENTICAL iff mode == FileTransformer.Mode.CHECK and the output produced by transform(String, File, File, Mode) would not be identical with the input
java.io.IOException
See Also:
NOT_IDENTICAL, FileTransformer.Mode.TRANSFORM, FileTransformer.Mode.CHECK, FileTransformer.Mode.CHECK_AND_TRANSFORM