public class FileUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
copy(String src,
String dst) |
static String |
createTempFileWithLines(String suffix,
Iterable<String> lines)
Create a temporary file (see
File.createTempFile(String, String) ) and fill it with the given lines. |
static File |
extractFromResource(String name)
Helper method for extracting a given resource to File
|
static Collection<File> |
getClasses(File root) |
static Collection<String> |
readAllLines(File file) |
static Collection<String> |
readAllLines(Reader src) |
static void |
safelyClose(Channel channel) |
static void |
safelyClose(InputStream in) |
static void |
safelyClose(OutputStream out) |
static void |
safelyClose(Reader reader) |
static Collection<String> |
tail(File file,
int num) |
static File |
tempFile(String suffix) |
static void |
touch(String f) |
public static File tempFile(String suffix) throws IOException
IOException
public static File extractFromResource(String name) throws IOException
name
- name of the resourceIOException
- if things go crazypublic static String createTempFileWithLines(String suffix, Iterable<String> lines) throws IOException
File.createTempFile(String, String)
) and fill it with the given lines.suffix
- file suffix File.createTempFile(String, String)
lines
- to be writtenIOException
- on file creation errorpublic static Collection<String> tail(File file, int num) throws IOException
IOException
public static Collection<String> readAllLines(Reader src) throws IOException
IOException
public static Collection<String> readAllLines(File file) throws IOException
IOException
public static Collection<File> getClasses(File root)
public static void copy(String src, String dst) throws IOException
IOException
public static void safelyClose(OutputStream out)
public static void safelyClose(InputStream in)
public static void safelyClose(Channel channel)
public static void safelyClose(Reader reader)
public static void touch(String f) throws IOException
IOException
Copyright © 2016. All rights reserved.