public class FileTools extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ENCODING |
static String |
FILE_EXTENSION_SEPARATOR |
static boolean |
FORCE_CREATE_PARENT_DIRS |
static Charset |
UTF8_CHARSET |
static String |
UTF8_ENCODING |
Constructor and Description |
---|
FileTools() |
Modifier and Type | Method and Description |
---|---|
static String |
convertStreamToString(InputStream is) |
static String |
convertStreamToString2(InputStream is) |
static boolean |
copyFile(String sourceFileName,
String destFileName,
boolean forceParentDirs) |
static File |
createTmpDir(String filePrefix)
If you have Java 7, you can simply call java.nio.file.Files.createTempDirectory()
|
static boolean |
fileSystemIsDOS() |
static boolean |
fileSystemIsMac() |
static String |
fixFilename(String filename) |
static void |
forceParentDirectories(String filename) |
static String |
getFilenameBase(String filename) |
static String |
getFilenameExtension(String filename) |
static String |
getFilenamePath(String filename) |
static String |
getJavaTmpDirInfo()
Returns information about the Java temporary directory,
including its path and selected access rights of the
current code to that directory.
|
static Object |
getJaxbObjectFromFile(Class<?> jaxbClass,
String fileName) |
protected static Object |
getObjectFromStream(Class<?> jaxbClass,
InputStream is)
getObjectFromStream get object of given class from given inputstream
|
static String |
join(String dir,
String file) |
static String |
readFile(File theFile) |
static String |
readFile(String dir,
String relPath) |
static List<String> |
readFileAsLines(String filePath) |
static String |
safeFilename(String relPath) |
static File |
saveFile(String dir,
String relativeName,
String content,
boolean forceParentDirs) |
static File |
saveFile(String dir,
String relativeName,
String content,
boolean forceParentDirs,
String encoding) |
static void |
writeFileFromLines(String filePath,
Iterable<? extends CharSequence> lines) |
public static String DEFAULT_ENCODING
public static String UTF8_ENCODING
public static Charset UTF8_CHARSET
public static boolean FORCE_CREATE_PARENT_DIRS
public static final String FILE_EXTENSION_SEPARATOR
protected static Object getObjectFromStream(Class<?> jaxbClass, InputStream is) throws Exception
jaxbClass
- is
- stream to read to construct the objectException
public static Object getJaxbObjectFromFile(Class<?> jaxbClass, String fileName) throws Exception
Exception
public static String convertStreamToString2(InputStream is)
public static String convertStreamToString(InputStream is)
public static void forceParentDirectories(String filename) throws IOException
IOException
public static boolean copyFile(String sourceFileName, String destFileName, boolean forceParentDirs) throws IOException
IOException
public static void writeFileFromLines(String filePath, Iterable<? extends CharSequence> lines)
public static File saveFile(String dir, String relativeName, String content, boolean forceParentDirs)
public static File saveFile(String dir, String relativeName, String content, boolean forceParentDirs, String encoding)
public static File createTmpDir(String filePrefix)
public static String getJavaTmpDirInfo()
public static boolean fileSystemIsDOS()
public static boolean fileSystemIsMac()
public static String getFilenamePath(String filename)
Copyright © 2016. All rights reserved.