概述 | 软件包 | 类 | 使用 | 树 | 已过时 | 索引 | 帮助
上一个类 下一个类 | 框架 无框架
摘要： 嵌套 | 字段 | 构造函数 | 方法 | 详细信息： 字段 | 构造函数 | 方法

## tot.util
类 FileUtil

    java.lang.Object
      tot.util.FileUtil

    public final class FileUtil

extends java.lang.Object

方法摘要
`static void` | `checkGoodFileName(java.lang.String str)`
`static void` | `checkGoodFilePath(java.lang.String str)`
`static void` | `copyFile(java.lang.String srcFilename, java.lang.String destFilename, boolean overwrite)`
`static void` | `createDir(java.lang.String dir, boolean ignoreIfExitst)`
`static void` | `createDirs(java.lang.String dir, boolean ignoreIfExitst)`
`static void` | `createFile(java.lang.String content, java.lang.String fileName, java.lang.String destEncoding)`
`static void` | `createTextFile(java.io.InputStream inputStream, java.lang.String textFile)` This method create a file text/css NOTE: This method closes the inputStream after it have done its work.
`static void` | `deleteDir(java.io.File dir)`
`static void` | `deleteFile(java.lang.String filename)`
`static void` | `emptyFile(java.lang.String srcFilename)`
`static byte[]` | `getBytes(java.io.InputStream inputStream)`
`static java.lang.String` | `getDefaultEncoding()` Get System default Encoding
`static long` | `getDirLength_onDisk(java.io.File dir)`
`static long` | `getDirLength(java.io.File dir)`
`static java.lang.String` | `getFileName(java.lang.String fullFilePath)`
`static java.lang.String` | `getHumanSize(long size)`
`static java.lang.String[]` | `getLastLines(java.io.File file, int linesToReturn)`
`static java.util.Collection` | `getList(java.lang.String strPath)` Get File list
`static java.lang.String` | `getSeparator()`
`static java.lang.String` | `getServletClassesPath()` This function is used to get the classpath of a reference of one class First, this method tries to get the path from system properties named "totcms.context.path" (can be configed in web.xml).
`static void` | `popFile(java.io.File srcFile, java.io.OutputStream output)` This method write srcFile to the output, and does not close the output
`static java.lang.String` | `readFile(java.lang.String fileName, java.lang.String srcEncoding)`
`static void` | `setServletClassesPath(java.lang.String path)` This method could be used to override the path to WEB-INF/classes It can be set when the web app is inited
`static void` | `writeFile(java.lang.String content, java.lang.String fileName, java.lang.String destEncoding)` Write content to a fileName with the destEncoding

从类 java.lang.Object 继承的方法
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

方法详细信息

### getSeparator

    public static java.lang.String getSeparator()

### getDefaultEncoding

    public static java.lang.String getDefaultEncoding()

  Get System default Encoding

### getList

    public static java.util.Collection getList(java.lang.String strPath)

  Get File list

### checkGoodFilePath

    public static void checkGoodFilePath(java.lang.String str)
                                  throws BadInputException

  抛出：
    `BadInputException`

### checkGoodFileName

    public static void checkGoodFileName(java.lang.String str)
                                  throws BadInputException

  抛出：
    `BadInputException`

### createDir

    public static void createDir(java.lang.String dir,
                                 boolean ignoreIfExitst)
                          throws java.io.IOException

  抛出：
    `java.io.IOException`

### createDirs

    public static void createDirs(java.lang.String dir,
                                  boolean ignoreIfExitst)
                           throws java.io.IOException

  抛出：
    `java.io.IOException`

### deleteFile

    public static void deleteFile(java.lang.String filename)
                           throws java.io.IOException

  抛出：
    `java.io.IOException`

### deleteDir

    public static void deleteDir(java.io.File dir)
                          throws java.io.IOException

  抛出：
    `java.io.IOException`

### getDirLength

    public static long getDirLength(java.io.File dir)
                             throws java.io.IOException

  抛出：
    `java.io.IOException`

### getDirLength_onDisk

    public static long getDirLength_onDisk(java.io.File dir)
                                    throws java.io.IOException

  抛出：
    `java.io.IOException`

### emptyFile

    public static void emptyFile(java.lang.String srcFilename)
                          throws java.io.IOException

  抛出：
    `java.io.IOException`

### copyFile

    public static void copyFile(java.lang.String srcFilename,
                                java.lang.String destFilename,
                                boolean overwrite)
                         throws java.io.IOException

  抛出：
    `java.io.IOException`

### getBytes

    public static byte[] getBytes(java.io.InputStream inputStream)
                           throws java.io.IOException

  抛出：
    `java.io.IOException`

### getFileName

    public static java.lang.String getFileName(java.lang.String fullFilePath)

### popFile

    public static void popFile(java.io.File srcFile,
                               java.io.OutputStream output)
                        throws java.io.IOException

  This method write srcFile to the output, and does not close the output

  参数：
    `srcFile` - File the source (input) file
    `output` - OutputStream the stream to write to, this method will not buffered the output
  抛出：
    `java.io.IOException`

### setServletClassesPath

    public static void setServletClassesPath(java.lang.String path)

  This method could be used to override the path to WEB-INF/classes It can be set when the web app is inited

  参数：
    `path` - String : new path to override the default path

### getServletClassesPath

    public static java.lang.String getServletClassesPath()

  This function is used to get the classpath of a reference of one class First, this method tries to get the path from system properties named "totcms.context.path" (can be configed in web.xml). If it cannot find this parameter, then it will tries to load from the ClassLoader FIXME: load from ClassLoader is not correct on Resin/Linux

### createTextFile

    public static void createTextFile(java.io.InputStream inputStream,
                                      java.lang.String textFile)
                               throws java.io.IOException

  This method create a file text/css NOTE: This method closes the inputStream after it have done its work.

  参数：
    `inputStream` - the stream of a text/css file
    `textFile` - the output file, have the ".css" extension or orther extension
  抛出：
    `java.io.IOException`
    `BadInputException`
    `AssertionException`

### writeFile

    public static void writeFile(java.lang.String content,
                                 java.lang.String fileName,
                                 java.lang.String destEncoding)
                          throws java.io.FileNotFoundException,
                                 java.io.IOException

  Write content to a fileName with the destEncoding

  参数：
    `content` - String
    `fileName` - String
    `destEncoding` - String
  抛出：
    `java.io.FileNotFoundException`
    `java.io.IOException`

### createFile

    public static void createFile(java.lang.String content,
                                  java.lang.String fileName,
                                  java.lang.String destEncoding)

### readFile

    public static java.lang.String readFile(java.lang.String fileName,
                                            java.lang.String srcEncoding)
                                     throws java.io.FileNotFoundException,
                                            java.io.IOException

  抛出：
    `java.io.FileNotFoundException`
    `java.io.IOException`

### getLastLines

    public static java.lang.String[] getLastLines(java.io.File file,
                                                  int linesToReturn)
                                           throws java.io.IOException,
                                                  java.io.FileNotFoundException

  抛出：
    `java.io.IOException`
    `java.io.FileNotFoundException`

### getHumanSize

    public static java.lang.String getHumanSize(long size)

概述 | 软件包 | 类 | 使用 | 树 | 已过时 | 索引 | 帮助
上一个类 下一个类 | 框架 无框架
摘要： 嵌套 | 字段 | 构造函数 | 方法 | 详细信息： 字段 | 构造函数 | 方法