com.alibaba.excel.util

类 FileUtils


  • public class FileUtils
    extends Object
    作者:
    jipengfei
    • 方法详细资料

      • 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 -
        返回:
        抛出:
        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 -
        返回:
        抛出:
        IOException
      • writeToFile

        public static void writeToFile(File file,
                                       InputStream inputStream)
        Write inputStream to file
        参数:
        file -
        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 -
      • 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)

Copyright © 2018–2019 Alibaba Group. All rights reserved.