com.alibaba.excel.util

类 FileUtils


  • public class FileUtils
    extends Object
    Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
    作者:
    Apache Software Foundation (ASF)
    • 方法详细资料

      • 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 - file
        inputStream - inputStream
      • writeToFile

        public static void writeToFile(File file,
                                       InputStream inputStream,
                                       boolean closeInputStream)
        Write inputStream to file
        参数:
        file - file
        inputStream - inputStream
        closeInputStream - closeInputStream
      • 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–2021 Alibaba Group. All rights reserved.