Package com.igormaznitsa.jcp.utils
Class PreprocessorUtils
java.lang.Object
com.igormaznitsa.jcp.utils.PreprocessorUtils
It is an auxiliary class contains some useful methods
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidstatic voidstatic voidcopyFileAttributes(File from, File to) static StringextractTail(String prefix, String value) static StringextractTrimmedTail(String prefix, String value) static StringgenerateStringForChar(char chr, int length) static StringgetFileExtension(File file) static StringgetFilePath(File file) static Stringstatic booleanisFileContentEquals(File src, File dst) static Stringstatic BufferedReadermakeFileReader(File file, String charset, int bufferSize) static StringnormalizeVariableName(String name) static StringprocessMacroses(String processingString, PreprocessorContext context) static byte[]readFileAsByteArray(File file) static String[]readWholeTextFileIntoArray(File file, String encoding, AtomicBoolean endedByNextLine) static String[]replaceChar(String[] source, char toBeReplaced, char replacement) static StringreplacePartByChar(String text, char chr, int startPosition, int length) static String[]replaceStringPrefix(String[] allowedPrefixesToBeReplaced, String replacement, String[] strings) static String[]splitExtensionCommaList(String extensions) static String[]splitForChar(String string, char delimiter) static String[]splitForCharAndHoldEmptyLine(String string, char delimiter) static String[]splitForEqualChar(String string) static voidthrowPreprocessorException(String msg, String processingString, File srcFile, int nextStringIndex, Throwable cause)
-
Field Details
-
PATTERN_MACROS_WITH_SPACES
-
LINE_END
-
-
Constructor Details
-
PreprocessorUtils
private PreprocessorUtils()
-
-
Method Details
-
getFileExtension
-
splitExtensionCommaList
@MustNotContainNull @ThrowsRuntimeException(value=java.lang.NullPointerException.class, reference="if extensions are null") public static String[] splitExtensionCommaList(String extensions) -
makeFileReader
public static BufferedReader makeFileReader(File file, String charset, int bufferSize) throws IOException - Throws:
IOException
-
replaceChar
@MustNotContainNull public static String[] replaceChar(@MustNotContainNull String[] source, char toBeReplaced, char replacement) -
extractTrimmedTail
-
extractTail
-
copyFile
- Throws:
IOException
-
copyFileAttributes
-
replacePartByChar
-
generateStringForChar
-
processMacroses
-
checkFile
- Throws:
IOException
-
readWholeTextFileIntoArray
@MustNotContainNull public static String[] readWholeTextFileIntoArray(File file, String encoding, AtomicBoolean endedByNextLine) throws IOException - Throws:
IOException
-
readFileAsByteArray
- Throws:
IOException
-
splitForEqualChar
-
splitForCharAndHoldEmptyLine
@MustNotContainNull public static String[] splitForCharAndHoldEmptyLine(String string, char delimiter) -
splitForChar
-
normalizeVariableName
-
getFilePath
-
throwPreprocessorException
-
replaceStringPrefix
@MustNotContainNull public static String[] replaceStringPrefix(@MustNotContainNull String[] allowedPrefixesToBeReplaced, String replacement, @MustNotContainNull String[] strings) -
getNextLineCodes
-
leftTrim
-
isFileContentEquals
- Throws:
IOException
-