Package com.igormaznitsa.jcp.utils
Enum PreprocessorUtils
- java.lang.Object
-
- java.lang.Enum<PreprocessorUtils>
-
- com.igormaznitsa.jcp.utils.PreprocessorUtils
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<PreprocessorUtils>
public enum PreprocessorUtils extends java.lang.Enum<PreprocessorUtils>
It is an auxiliary class contains some useful methods
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LINE_END
-
Constructor Summary
Constructors Modifier Constructor Description private
PreprocessorUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertNotNull(java.lang.String message, java.lang.Object obj)
private static void
checkFile(java.io.File file)
static void
copyFile(java.io.File source, java.io.File dest)
static java.lang.String
extractTail(java.lang.String prefix, java.lang.String value)
static java.lang.String
extractTrimmedTail(java.lang.String prefix, java.lang.String value)
static java.lang.String
getFileExtension(java.io.File file)
static java.lang.String
getFilePath(java.io.File file)
static java.lang.String
getNextLineCodes()
static boolean
isFileContentEquals(java.io.File src, java.io.File dst)
static java.lang.String
leftTrim(java.lang.String rawString)
static java.io.BufferedReader
makeFileReader(java.io.File file, java.lang.String charset, int bufferSize)
static java.lang.String
normalizeVariableName(java.lang.String name)
static java.lang.String
processMacroses(java.lang.String processingString, PreprocessorContext context)
static byte[]
readFileAsByteArray(java.io.File file)
static java.lang.String[]
readWholeTextFileIntoArray(java.io.File file, java.lang.String encoding, java.util.concurrent.atomic.AtomicBoolean endedByNextLine)
static java.lang.String[]
replaceChar(java.lang.String[] source, char toBeReplaced, char replacement)
static java.lang.String[]
replaceStringPrefix(java.lang.String[] allowedPrefixesToBeReplaced, java.lang.String replacement, java.lang.String[] strings)
static java.lang.String[]
splitExtensionCommaList(java.lang.String extensions)
static java.lang.String[]
splitForChar(java.lang.String string, char delimiter)
static java.lang.String[]
splitForEqualChar(java.lang.String string)
static void
throwPreprocessorException(java.lang.String msg, java.lang.String processingString, java.io.File srcFile, int nextStringIndex, java.lang.Throwable cause)
static PreprocessorUtils
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static PreprocessorUtils[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Method Detail
-
values
public static PreprocessorUtils[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PreprocessorUtils c : PreprocessorUtils.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PreprocessorUtils valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getFileExtension
public static java.lang.String getFileExtension(java.io.File file)
-
splitExtensionCommaList
public static java.lang.String[] splitExtensionCommaList(java.lang.String extensions)
-
assertNotNull
public static void assertNotNull(java.lang.String message, java.lang.Object obj)
-
makeFileReader
public static java.io.BufferedReader makeFileReader(java.io.File file, java.lang.String charset, int bufferSize) throws java.io.IOException
- Throws:
java.io.IOException
-
replaceChar
public static java.lang.String[] replaceChar(java.lang.String[] source, char toBeReplaced, char replacement)
-
extractTrimmedTail
public static java.lang.String extractTrimmedTail(java.lang.String prefix, java.lang.String value)
-
extractTail
public static java.lang.String extractTail(java.lang.String prefix, java.lang.String value)
-
copyFile
public static void copyFile(java.io.File source, java.io.File dest) throws java.io.IOException
- Throws:
java.io.IOException
-
processMacroses
public static java.lang.String processMacroses(java.lang.String processingString, PreprocessorContext context)
-
checkFile
private static void checkFile(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
readWholeTextFileIntoArray
public static java.lang.String[] readWholeTextFileIntoArray(java.io.File file, java.lang.String encoding, java.util.concurrent.atomic.AtomicBoolean endedByNextLine) throws java.io.IOException
- Throws:
java.io.IOException
-
readFileAsByteArray
public static byte[] readFileAsByteArray(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
splitForEqualChar
public static java.lang.String[] splitForEqualChar(java.lang.String string)
-
splitForChar
public static java.lang.String[] splitForChar(java.lang.String string, char delimiter)
-
normalizeVariableName
public static java.lang.String normalizeVariableName(java.lang.String name)
-
getFilePath
public static java.lang.String getFilePath(java.io.File file)
-
throwPreprocessorException
public static void throwPreprocessorException(java.lang.String msg, java.lang.String processingString, java.io.File srcFile, int nextStringIndex, java.lang.Throwable cause)
-
replaceStringPrefix
public static java.lang.String[] replaceStringPrefix(java.lang.String[] allowedPrefixesToBeReplaced, java.lang.String replacement, java.lang.String[] strings)
-
getNextLineCodes
public static java.lang.String getNextLineCodes()
-
leftTrim
public static java.lang.String leftTrim(java.lang.String rawString)
-
isFileContentEquals
public static boolean isFileContentEquals(java.io.File src, java.io.File dst) throws java.io.IOException
- Throws:
java.io.IOException
-
-