public class ReplaceTextInFile
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
baseDirectory |
private static java.lang.String |
encoding |
private static java.lang.String |
filePattern |
private static java.lang.String |
fromText |
private static boolean |
havePrintedTokens |
private static int |
replacePatterns |
private static java.lang.String |
toText |
(package private) static java.lang.String |
usage |
Constructor and Description |
---|
ReplaceTextInFile() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getBaseDirectory() |
static java.lang.String |
getEncoding() |
static java.lang.String |
getFilePattern() |
static java.lang.String |
getFromText() |
private static int |
getReplacePatterns() |
static java.lang.String |
getToText() |
private static void |
incReplacePatterns()
Increment the replacePatterns counter
|
private static boolean |
isHavePrintedTokens() |
static void |
main(java.lang.String[] args) |
private static void |
println() |
private static void |
println(java.lang.String str) |
static void |
replaceAll(java.lang.String from,
java.lang.String to,
java.lang.String fileIn,
java.lang.String encoding1)
Replace 'from' with 'to' in 'file-in' using the specified encoding
|
static void |
replaceInFilesFromBase(java.io.File baseDir)
Find all the files to process under the specified base directory - then process each one.
|
static void |
setBaseDirectory(java.lang.String baseDirectory) |
static void |
setEncoding(java.lang.String encoding) |
static void |
setFilePattern(java.lang.String filePattern) |
static void |
setFromText(java.lang.String fromText) |
private static void |
setHavePrintedTokens(boolean havePrintedTokens) |
private static void |
setReplacePatterns(int replacePatterns) |
static void |
setToText(java.lang.String toText) |
static final java.lang.String usage
private static java.lang.String baseDirectory
private static java.lang.String filePattern
private static java.lang.String fromText
private static java.lang.String toText
private static java.lang.String encoding
private static boolean havePrintedTokens
private static int replacePatterns
public static void main(java.lang.String[] args)
args
- the argspublic static void replaceInFilesFromBase(java.io.File baseDir) throws java.io.IOException, com.konakart.app.KKException
baseDir
- the baseDirjava.io.IOException
- an unexpected IOException exceptioncom.konakart.app.KKException
- an unexpected KKException exceptionpublic static void replaceAll(java.lang.String from, java.lang.String to, java.lang.String fileIn, java.lang.String encoding1) throws java.io.IOException, com.konakart.app.KKException
from
- the fromto
- the tofileIn
- the fileInencoding1
- the encoding1java.io.IOException
- an unexpected IOException exceptioncom.konakart.app.KKException
- an unexpected KKException exceptionprivate static void println(java.lang.String str)
private static void println()
public static java.lang.String getFilePattern()
public static void setFilePattern(java.lang.String filePattern)
filePattern
- the filePattern to setpublic static java.lang.String getFromText()
public static void setFromText(java.lang.String fromText)
fromText
- the fromText to setpublic static java.lang.String getToText()
public static void setToText(java.lang.String toText)
toText
- the toText to setpublic static java.lang.String getEncoding()
public static void setEncoding(java.lang.String encoding)
encoding
- the encoding to setpublic static java.lang.String getBaseDirectory()
public static void setBaseDirectory(java.lang.String baseDirectory)
baseDirectory
- the baseDirectory to setprivate static boolean isHavePrintedTokens()
private static void setHavePrintedTokens(boolean havePrintedTokens)
havePrintedTokens
- the havePrintedTokens to setprivate static int getReplacePatterns()
private static void incReplacePatterns()
private static void setReplacePatterns(int replacePatterns)
replacePatterns
- the replacePatterns to setCopyright © 2018 DS Data Systems UK Ltd.