public class FileUtil extends Object
Modifier and Type | Method and Description |
---|---|
static int |
getIntFromFile(String filename)
Read a file and return the int value contained therein.
|
static Map<String,String> |
getKeyValueMapFromFile(String filename,
String separator)
Read a file and return a map of string keys to string values contained
therein.
|
static long |
getLongFromFile(String filename)
Read a file and return the long value contained therein.
|
static String[] |
getSplitFromFile(String filename)
Read a file and return an array of whitespace-delimited string values
contained therein.
|
static String |
getStringFromFile(String filename)
Read a file and return the String value contained therein.
|
static List<String> |
readFile(String filename)
Read an entire file at one time.
|
static List<String> |
readFile(String filename,
boolean reportError)
Read an entire file at one time.
|
public static List<String> readFile(String filename)
filename
- The file to readpublic static List<String> readFile(String filename, boolean reportError)
filename
- The file to readreportError
- Whether to log errors reading the filepublic static long getLongFromFile(String filename)
filename
- The file to readpublic static int getIntFromFile(String filename)
filename
- The file to readpublic static String getStringFromFile(String filename)
filename
- The file to readpublic static String[] getSplitFromFile(String filename)
filename
- The file to readpublic static Map<String,String> getKeyValueMapFromFile(String filename, String separator)
filename
- The file to readseparator
- Characters in each line of the file that separate the key and
the valueCopyright © 2010–2017 oshi. All rights reserved.