类 FileUtils

java.lang.Object
com.sh.wf.excel.util.FileUtils

public class FileUtils extends Object
  • 字段详细资料

  • 方法详细资料

    • readFileToByteArray

      public static byte[] readFileToByteArray(File file) throws IOException
      Reads the contents of a file into a byte array. * The file is always closed.
      参数:
      file - File
      返回:
      byte[]
      抛出:
      IOException - IOException
    • openInputStream

      public static FileInputStream openInputStream(File file) throws IOException
      Opens a FileInputStream for the specified file, providing better error messages than simply calling new FileInputStream(file).

      At the end of the method either the stream will be successfully opened, or an exception will have been thrown.

      An exception is thrown if the file does not exist. An exception is thrown if the file object exists but is a directory. An exception is thrown if the file exists but cannot be read.

      参数:
      file - File
      返回:
      FileInputStream
      抛出:
      IOException - IOException
    • writeToFile

      public static void writeToFile(File file, InputStream inputStream)
      Write inputStream to file
      参数:
      file - File
      inputStream - InputStream
    • createPoiFilesDirectory

      public static void createPoiFilesDirectory()
    • createCacheTmpFile

      public static File createCacheTmpFile()
    • createTmpFile

      public static File createTmpFile(String fileName)
    • delete

      public static void delete(File file)
      delete file
      参数:
      file - File
    • getTempFilePrefix

      public static String getTempFilePrefix()
    • setTempFilePrefix

      public static void setTempFilePrefix(String tempFilePrefix)
    • getPoiFilesPath

      public static String getPoiFilesPath()
    • setPoiFilesPath

      public static void setPoiFilesPath(String poiFilesPath)
    • getCachePath

      public static String getCachePath()
    • setCachePath

      public static void setCachePath(String cachePath)