public final class FileContentWorker extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
files_equal(File f1,
File f2)
Checks that two files are equal.
|
static byte[] |
read_contents_bin(File binFile)
Obtains the contents of a file as a binary array.
|
static String |
read_contents(File file)
Reads a file's contents.
|
static byte[] |
read_resource_bin(String name)
Reads a file's contents as binary data (the file is expected to be a
resource).
|
static String |
read_resource(Class<?> cls,
String name)
Reads a file's contents (the file is expected to be a resource).
|
static String |
read_resource(String name)
Reads a file's contents (the file is expected to be a resource).
|
static void |
set_contents_bin(File f,
byte[] data)
Changes the contents of a file (or creates a new file if it doesn't
exist).
|
static void |
set_contents(File f,
String s)
Changes the contents of a file (or creates a new file if it doesn't
exist).
|
public static String read_contents(File file) throws IOException
file - the fileIOException - failed to read the filepublic static byte[] read_contents_bin(File binFile) throws IOException
binFile - the fileIOException - failed to read the filepublic static void set_contents(File f, String s) throws IOException
f - the file to changes - the file's new contentsIOException - failed to write the filepublic static void set_contents_bin(File f, byte[] data) throws IOException
f - the file to changedata - the new file's contentsIOException - failed to write the filepublic static String read_resource(String name) throws IOException
name - the resource nameIOException - failed to read the resourcepublic static String read_resource(Class<?> cls, String name) throws IOException
cls - a class defining the package where the resource is locatedname - the resource nameIOException - failed to read the resourcepublic static byte[] read_resource_bin(String name) throws IOException
name - the resource nameIOException - failed to read the resourcepublic static boolean files_equal(File f1, File f2) throws IOException
f1 - first filef2 - second fileIOException - failed to read the filesCopyright © 2015. All rights reserved.