public class Util extends Object
| Modifier and Type | Field and Description |
|---|---|
static MiniParser |
MINI_PARSER |
static MiniParser |
NO_QUOTE_MINI_PARSER |
static MiniParser |
RAW_MINI_PARSER |
static MiniParser |
RAW_OUTPUT_MINI_PARSER |
| Constructor and Description |
|---|
Util() |
| Modifier and Type | Method and Description |
|---|---|
static List<Object> |
arrayAsList(Object value)
Transforms any array to a matching list
|
static <T> Set<T> |
asSet(T... a) |
static String |
extractArrayIndex(String objectName) |
static String |
extractArrayName(String objectName) |
static String |
fileToString(File file,
String charsetName)
Transforms a file into a string.
|
static String |
fileToString(String fileName,
String charsetName)
Transforms a file into a string.
|
static boolean |
isArrayAccess(String objectName) |
static boolean |
isValidArrayAccess(String objectName) |
static String |
readerToString(Reader reader)
Transforms a reader into a string.
|
static String |
resourceToString(String resourceName,
String charsetName)
Loads a stream from the classpath and transforms it into a string.
|
static List<StartEndPair> |
scan(String input,
String splitStart,
String splitEnd,
boolean useEscaping)
Scans the input and spits out begin/end pairs telling you where
expressions can be found.
|
static byte[] |
streamToBa(InputStream is) |
static String |
streamToString(InputStream is,
String charsetName)
Transforms a stream into a string.
|
static void |
stringToFile(String string,
File file,
String charsetName)
Writes a string into a file.
|
static String |
trimFront(String input)
Trims off white space from the beginning of a string.
|
static String |
unifyNewlines(String source) |
public static final MiniParser MINI_PARSER
public static final MiniParser RAW_MINI_PARSER
public static final MiniParser NO_QUOTE_MINI_PARSER
public static final MiniParser RAW_OUTPUT_MINI_PARSER
public static void stringToFile(String string, File file, String charsetName)
string - the stringfile - the filecharsetName - encoding of the filepublic static String fileToString(File file, String charsetName)
file - the file to be transformedcharsetName - encoding of the filepublic static String fileToString(String fileName, String charsetName)
fileName - name of the file to be transformedcharsetName - encoding of the filepublic static String streamToString(InputStream is, String charsetName)
is - the stream to be transformedcharsetName - encoding of the filepublic static String resourceToString(String resourceName, String charsetName)
resourceName - the name of the resource to be transformedcharsetName - encoding of the resourceClassLoader.getResourceAsStream(String)public static String readerToString(Reader reader)
reader - the reader to be transformedpublic static byte[] streamToBa(InputStream is)
public static List<Object> arrayAsList(Object value)
value - something that might be an arraynull otherwisepublic static boolean isArrayAccess(String objectName)
public static boolean isValidArrayAccess(String objectName)
public static String trimFront(String input)
input - the string to be trimmedpublic static List<StartEndPair> scan(String input, String splitStart, String splitEnd, boolean useEscaping)
input - the inputpublic static <T> Set<T> asSet(T... a)
Copyright © 2017. All rights reserved.