| java.lang.Object org.zkoss.io.Files
Files | public class Files (Code) | | File related utilities.
author: tomyeh |
Field Summary | |
public static int | CP_OVERWRITE Overwrites the destination file. | public static int | CP_PRESERVE Preserves the last modified time and other attributes if possible. | public static int | CP_UPDATE Copy only when the source is newer or when the destination is missing. | final public static char | DRIVE_SEPARATOR_CHAR The separator representing the drive in a path. |
Constructor Summary | |
protected | Files() |
Method Summary | |
final public static void | close(InputStream strm) Close an input stream without throwing an exception. | final public static void | close(Reader reader) Close a reader without throwing an exception. | final public static void | copy(Writer writer, Reader reader) Copies a reader into a writer. | final public static void | copy(OutputStream out, InputStream in) Copies an input stream to a output stream. | final public static void | copy(File dst, Reader reader, String charset) Copies a reader into a file (the original content, if any, are erased). | final public static void | copy(File dst, InputStream in) Copies an input stream into a file
(the original content, if any, are erased). | final public static void | copy(File dst, File src, int flags) Copies a file or a directory into another. | final public static String | correctSeparator(String flnm) Corrects the separator from '/' to the system dependent one. | final public static boolean | deleteAll(File file) Deletes all files under the specified path. | final public static File | getConfigDirectory() Returns the conf directory. | final public static byte[] | readAll(InputStream in) Returns all bytes in the input stream, never null
(but its length might zero). | final public static StringBuffer | readAll(Reader reader) Returns all characters in the reader, never null
(but its length might zero). |
DRIVE_SEPARATOR_CHAR | final public static char DRIVE_SEPARATOR_CHAR(Code) | | The separator representing the drive in a path. In Windows, it is
':', while 0 in other platforms.
|
close | final public static void close(InputStream strm)(Code) | | Close an input stream without throwing an exception.
|
close | final public static void close(Reader reader)(Code) | | Close a reader without throwing an exception.
|
copy | final public static void copy(Writer writer, Reader reader) throws IOException(Code) | | Copies a reader into a writer.
Parameters: writer - the destination Parameters: reader - the source |
copy | final public static void copy(File dst, Reader reader, String charset) throws IOException(Code) | | Copies a reader into a file (the original content, if any, are erased).
The source and destination files will be closed after copied.
Parameters: dst - the destination Parameters: reader - the source Parameters: charset - the charset; null as default (ISO-8859-1). |
copy | final public static void copy(File dst, InputStream in) throws IOException(Code) | | Copies an input stream into a file
(the original content, if any, are erased).
The file will be closed after copied.
Parameters: dst - the destination Parameters: in - the source |
correctSeparator | final public static String correctSeparator(String flnm)(Code) | | Corrects the separator from '/' to the system dependent one.
Note: i3 always uses '/' while Windows uses '\\'.
|
deleteAll | final public static boolean deleteAll(File file)(Code) | | Deletes all files under the specified path.
|
getConfigDirectory | final public static File getConfigDirectory()(Code) | | Returns the conf directory.
The configure directory is assumed to be specified by
the system property called "org.zkoss.io.conf.dir".
If property not found, it assumes the conf or config directory under
the directory specified by the system property called "user.dir".
If property not found, it assumes the conf directory under
the current directory.
|
readAll | final public static byte[] readAll(InputStream in) throws IOException(Code) | | Returns all bytes in the input stream, never null
(but its length might zero).
Notice: this method is memory hungry.
|
readAll | final public static StringBuffer readAll(Reader reader) throws IOException(Code) | | Returns all characters in the reader, never null
(but its length might zero).
Notice: this method is memory hungry.
|
|
|