public class FileUtil
extends java.lang.Object
| Modifier and Type | Method and Description | 
|---|---|
| static java.lang.String | basename(java.io.File file)Get the base (i.e., simple file) name of a file. | 
| static java.lang.String | basename(java.lang.String fileName)Get the base (i.e., simple file) name of a file. | 
| static int | copyFile(java.io.File src,
        java.io.File dst)Copy one file to another. | 
| static int | copyReader(java.io.Reader reader,
          java.io.Writer writer)Copy characters from a reader to a writer, using a default buffer size. | 
| static int | copyReader(java.io.Reader reader,
          java.io.Writer writer,
          int bufferSize)Copy characters from a reader to a writer. | 
| static int | copyStream(java.io.InputStream is,
          java.io.OutputStream os)Copy an InputStream to an OutputStream. | 
| static int | copyStream(java.io.InputStream src,
          java.io.OutputStream dst,
          int bufferSize)Copy an InputStream to an OutputStream. | 
| static int | copyTextFile(java.io.File src,
            java.lang.String srcEncoding,
            java.io.File dst,
            java.lang.String dstEncoding)Copy one file to another, character by character, possibly doing
 character set conversions | 
| static java.lang.String | dirname(java.io.File file)Get the name of a file's parent directory. | 
| static java.lang.String | dirname(java.lang.String fileName)Get the name of a file's parent directory. | 
| static java.lang.String | getDefaultEncoding()Get the virtual machine's default encoding. | 
| static java.lang.String | getFileNameExtension(java.io.File file)Get the extension for a path or file name. | 
| static java.lang.String | getFileNameExtension(java.lang.String path)Get the extension for a path or file name. | 
| static java.lang.String | getFileNameNoExtension(java.io.File file)Get the name of a file without its extension. | 
| static java.lang.String | getFileNameNoExtension(java.lang.String path)Get the name of a file without its extension. | 
| static boolean | isAbsolutePath(java.lang.String path)Determine whether a string represents an absolute path. | 
public static boolean isAbsolutePath(java.lang.String path)
                              throws java.io.IOException
path - the path to checkjava.io.IOException - on errorpublic static int copyStream(java.io.InputStream is,
                             java.io.OutputStream os)
                      throws java.io.IOException
copyStream (src, dst, 8192);
is - the source InputStreamos - the destination OutputStreamjava.io.IOException - on errorcopyStream(InputStream,OutputStream,int), 
copyReader(Reader,Writer), 
copyFile(File,File)public static int copyStream(java.io.InputStream src,
                             java.io.OutputStream dst,
                             int bufferSize)
                      throws java.io.IOException
src - the source InputStreamdst - the destination OutputStreambufferSize - the buffer size to use, or -1 for a defaultjava.io.IOException - on errorcopyReader(Reader,Writer,int), 
copyStream(InputStream,OutputStream), 
copyFile(File,File)public static int copyReader(java.io.Reader reader,
                             java.io.Writer writer,
                             int bufferSize)
                      throws java.io.IOException
reader - where to read fromwriter - where to write tobufferSize - buffer size to use, if reader and writer are not
                   already buffered, or -1 to use a default size.java.io.IOException - on errorcopyReader(Reader,Writer), 
copyStream(InputStream,OutputStream,int), 
copyStream(InputStream,OutputStream), 
copyFile(File,File)public static int copyReader(java.io.Reader reader,
                             java.io.Writer writer)
                      throws java.io.IOException
reader - where to read fromwriter - where to write tojava.io.IOException - on errorcopyReader(Reader,Writer), 
copyStream(InputStream,OutputStream,int), 
copyStream(InputStream,OutputStream), 
copyFile(File,File)public static int copyFile(java.io.File src,
                           java.io.File dst)
                    throws java.io.IOException
copyTextFile(File,String,File,String).src - The file to copydst - Where to copy it. Can be a directory or a file.java.io.IOException - on errorcopyTextFile(File,String,File,String), 
copyReader(Reader,Writer,int), 
copyReader(Reader,Writer), 
copyStream(InputStream,OutputStream,int), 
copyStream(InputStream,OutputStream)public static int copyTextFile(java.io.File src,
                               java.lang.String srcEncoding,
                               java.io.File dst,
                               java.lang.String dstEncoding)
                        throws java.io.IOException
src - the file to copysrcEncoding - the character set encoding for the source file,
                    or null to assume the defaultdst - Where to copy it. Can be a directory or a file.dstEncoding - the character set encoding for the destination file,
                    or null to assume the defaultjava.io.IOException - on errorcopyFile(File,File), 
copyReader(Reader,Writer,int), 
copyReader(Reader,Writer), 
copyStream(InputStream,OutputStream,int), 
copyStream(InputStream,OutputStream)public static java.lang.String getDefaultEncoding()
public static java.lang.String getFileNameExtension(java.io.File file)
file - the filepublic static java.lang.String getFileNameExtension(java.lang.String path)
path - the file or path namepublic static java.lang.String getFileNameNoExtension(java.io.File file)
file - the filepublic static java.lang.String getFileNameNoExtension(java.lang.String path)
path - the pathpublic static java.lang.String dirname(java.lang.String fileName)
fileName - the file namedirname(File), 
basename(String)public static java.lang.String dirname(java.io.File file)
file - the file whose parent directory is to be returneddirname(String), 
basename(File)public static java.lang.String basename(java.lang.String fileName)
fileName - name of the file to get the basename fordirname(String)public static java.lang.String basename(java.io.File file)
file - the file to get the basename forbasename(String), 
dirname(File)