类 FileUtils
java.lang.Object
com.sh.wf.excel.util.FileUtils
-
字段概要
字段 -
方法概要
修饰符和类型方法说明static Filestatic voidstatic FilecreateTmpFile(String fileName) static voiddelete filestatic Stringstatic Stringstatic Stringstatic FileInputStreamopenInputStream(File file) Opens aFileInputStreamfor the specified file, providing better error messages than simply callingnew FileInputStream(file).static byte[]readFileToByteArray(File file) Reads the contents of a file into a byte array. * The file is always closed.static voidsetCachePath(String cachePath) static voidsetPoiFilesPath(String poiFilesPath) static voidsetTempFilePrefix(String tempFilePrefix) static voidwriteToFile(File file, InputStream inputStream) Write inputStream to file
-
字段详细资料
-
方法详细资料
-
readFileToByteArray
Reads the contents of a file into a byte array. * The file is always closed.- 参数:
file- File- 返回:
- byte[]
- 抛出:
IOException- IOException
-
openInputStream
Opens aFileInputStreamfor the specified file, providing better error messages than simply callingnew 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
Write inputStream to file- 参数:
file- FileinputStream- InputStream
-
createPoiFilesDirectory
public static void createPoiFilesDirectory() -
createCacheTmpFile
-
createTmpFile
-
delete
delete file- 参数:
file- File
-
getTempFilePrefix
-
setTempFilePrefix
-
getPoiFilesPath
-
setPoiFilesPath
-
getCachePath
-
setCachePath
-