|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.io.Files
public class Files
File related utilities.
| Field Summary | |
|---|---|
static int |
CP_OVERWRITE
Overwrites the destination file. |
static int |
CP_PRESERVE
Preserves the last modified time and other attributes if possible. |
static int |
CP_UPDATE
Copy only when the source is newer or when the destination is missing. |
static char |
DRIVE_SEPARATOR_CHAR
The separator representing the drive in a path. |
| Constructor Summary | |
|---|---|
protected |
Files()
|
| Method Summary | |
|---|---|
static void |
close(java.io.InputStream strm)
Close an input stream without throwing an exception. |
static void |
close(java.io.Reader reader)
Close a reader without throwing an exception. |
static void |
copy(java.io.File dst,
java.io.File src,
int flags)
Copies a file or a directory into another. |
static void |
copy(java.io.File dst,
java.io.InputStream in)
Copies an input stream into a file (the original content, if any, are erased). |
static void |
copy(java.io.File dst,
java.io.Reader reader,
java.lang.String charset)
Copies a reader into a file (the original content, if any, are erased). |
static void |
copy(java.io.OutputStream out,
java.io.InputStream in)
Copies an input stream to a output stream. |
static void |
copy(java.io.Writer writer,
java.io.Reader reader)
Copies a reader into a writer. |
static java.lang.String |
correctSeparator(java.lang.String flnm)
Corrects the separator from '/' to the system dependent one. |
static boolean |
deleteAll(java.io.File file)
Deletes all files under the specified path. |
static java.io.File |
getConfigDirectory()
Returns the conf directory. |
static byte[] |
readAll(java.io.InputStream in)
Returns all bytes in the input stream, never null (but its length might zero). |
static java.lang.StringBuffer |
readAll(java.io.Reader reader)
Returns all characters in the reader, never null (but its length might zero). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final char DRIVE_SEPARATOR_CHAR
public static int CP_PRESERVE
copy(File, File, int)public static int CP_UPDATE
copy(File, File, int)public static int CP_OVERWRITE
copy(File, File, int)| Constructor Detail |
|---|
protected Files()
| Method Detail |
|---|
public static final java.lang.String correctSeparator(java.lang.String flnm)
public static final java.io.File getConfigDirectory()
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.
public static final byte[] readAll(java.io.InputStream in)
throws java.io.IOException
Notice: this method is memory hungry.
java.io.IOException
public static final java.lang.StringBuffer readAll(java.io.Reader reader)
throws java.io.IOException
Notice: this method is memory hungry.
java.io.IOException
public static final void copy(java.io.Writer writer,
java.io.Reader reader)
throws java.io.IOException
writer - the destinationreader - the source
java.io.IOException
public static final void copy(java.io.OutputStream out,
java.io.InputStream in)
throws java.io.IOException
out - the destinationin - the source
java.io.IOException
public static final void copy(java.io.File dst,
java.io.Reader reader,
java.lang.String charset)
throws java.io.IOException
dst - the destinationreader - the sourcecharset - the charset; null as default (ISO-8859-1).
java.io.IOException
public static final void copy(java.io.File dst,
java.io.InputStream in)
throws java.io.IOException
dst - the destinationin - the source
java.io.IOException
public static final void copy(java.io.File dst,
java.io.File src,
int flags)
throws java.io.IOException
If neither CP_UPDATE nor CP_OVERWRITE,
IOException is thrown if the destination exists.
flags - any combination of CP_UPDATE, CP_PRESERVE,
CP_OVERWRITE.
java.io.IOExceptionpublic static final boolean deleteAll(java.io.File file)
public static final void close(java.io.InputStream strm)
public static final void close(java.io.Reader reader)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||