com.evanmclean.evlib.io
Class ReplacingFileCopier

java.lang.Object
  extended by com.evanmclean.evlib.io.ReplacingFileCopier

public class ReplacingFileCopier
extends Object

Copies files, replacing tokens like "%token%" with the substitute value. The token must start and end with the delimiter character (percent by default).

Author:
Evan McLean McLean Computer Services (see the overview for copyright and licensing.)

Constructor Summary
ReplacingFileCopier()
           
ReplacingFileCopier(char delimiter)
           
 
Method Summary
 void clear()
           
 boolean copy(File from, File to)
           
 void copy(File from, PrintWriter out)
           
 void copy(File from, Writer out)
           
 Set<Map.Entry<String,String>> entrySet()
           
 void errorHandler(File from, File to, IOException exception)
          Can be overridden to handle errors.
 char getDelimiter()
           
 boolean isEmpty()
           
 boolean isNoMatchError()
           
 String put(String key, String value)
           
 void putAll(Map<? extends String,? extends String> map)
           
 String remove(String key)
           
 void setDelimiter(char delim)
           
 void setNoMatchError(boolean no_match_error)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplacingFileCopier

public ReplacingFileCopier()

ReplacingFileCopier

public ReplacingFileCopier(char delimiter)
Method Detail

clear

public void clear()

copy

public boolean copy(File from,
                    File to)

copy

public void copy(File from,
                 PrintWriter out)
          throws IOException
Throws:
IOException

copy

public void copy(File from,
                 Writer out)
          throws IOException
Throws:
IOException

entrySet

public Set<Map.Entry<String,String>> entrySet()

errorHandler

public void errorHandler(File from,
                         File to,
                         IOException exception)
Can be overridden to handle errors.

Parameters:
from -
to -
exception -

getDelimiter

public char getDelimiter()

isEmpty

public boolean isEmpty()

isNoMatchError

public boolean isNoMatchError()

put

public String put(String key,
                  String value)

putAll

public void putAll(Map<? extends String,? extends String> map)

remove

public String remove(String key)

setDelimiter

public void setDelimiter(char delim)

setNoMatchError

public void setNoMatchError(boolean no_match_error)

size

public int size()