| java.lang.Object org.apache.ivy.util.FileUtil
FileUtil | final public class FileUtil (Code) | | Utility class used to deal with file related operations, like copy, full reading, symlink, ...
|
Method Summary | |
public static String | concat(String dir, String file) | public static boolean | copy(File src, File dest, CopyProgressListener l) | public static boolean | copy(File src, File dest, CopyProgressListener l, boolean overwrite) | public static void | copy(URL src, File dest, CopyProgressListener l) | public static void | copy(InputStream src, File dest, CopyProgressListener l) | public static void | copy(InputStream src, OutputStream dest, CopyProgressListener l) | public static void | forceDelete(File f) | public static List | getPathFiles(File root, File file) Returns a list of Files composed of all directories being parent of file and child of root +
file and root themselves. | public static Collection | listAll(File dir) Returns a collection of all Files being contained in the given directory, recursively,
including directories.
Parameters: dir - The directory from which all files, including files in subdirectory)are extracted. | public static String | readEntirely(BufferedReader in) Reads the whole BufferedReader line by line, using \n as line separator for each line. | public static String | readEntirely(File f) Reads the entire content of the file and returns it as a String. | public static String | readEntirely(InputStream is) Reads the entire content of the
InputStream and returns it as a String. | public static void | symlink(File src, File dest, CopyProgressListener l, boolean overwrite) |
forceDelete | public static void forceDelete(File f)(Code) | | |
getPathFiles | public static List getPathFiles(File root, File file)(Code) | | Returns a list of Files composed of all directories being parent of file and child of root +
file and root themselves. Example: getPathFiles(new File("test"), new
File("test/dir1/dir2/file.txt")) => {new File("test/dir1"), new File("test/dir1/dir2"), new
File("test/dir1/dir2/file.txt") } Note that if root is not an ancester of file, or if root is
null, all directories from the file system root will be returned.
|
listAll | public static Collection listAll(File dir)(Code) | | Returns a collection of all Files being contained in the given directory, recursively,
including directories.
Parameters: dir - The directory from which all files, including files in subdirectory)are extracted. A collectoin containing all the files of the given directory and it'ssubdirectories. |
readEntirely | public static String readEntirely(BufferedReader in) throws IOException(Code) | | Reads the whole BufferedReader line by line, using \n as line separator for each line.
Note that this method will add a final \n to the last line even though there is no new line
character at the end of last line in the original reader.
The BufferedReader is closed when this method returns.
Parameters: in - the BufferedReader to read from a String with the whole content read from the BufferedReader throws: IOException - if an IO problems occur during reading |
readEntirely | public static String readEntirely(File f) throws IOException(Code) | | Reads the entire content of the file and returns it as a String.
Parameters: f - the file to read from a String with the file content throws: IOException - if an IO problems occurs during reading |
readEntirely | public static String readEntirely(InputStream is) throws IOException(Code) | | Reads the entire content of the
InputStream and returns it as a String.
The input stream is closed when this method returns.
Parameters: is - the InputStream to read from a String with the input stream content throws: IOException - if an IO problems occurs during reading |
|
|