All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.rrsunhome.excelsql.util.ExcelInputStream Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package com.github.rrsunhome.excelsql.util;


import java.io.*;

/**
 * @author : qijia.wang
 * create at:  2020/4/3  下午10:44
 */
public class ExcelInputStream {

    /**
     * 根据路径创建输入流
     * @param path 路径
     * @return 输入流
     * @throws IOException io异常
     */
    public static InputStream createInputStream(String path) throws IOException {
        if (PathMatcher.matchUrl(path)) {
            return HttpUtils.read(path);
        }

        InputStream is = null;
        try {
            is = new FileInputStream(path);
        } catch (FileNotFoundException e) {
            throw new IllegalArgumentException("path " + path + "路径下资源不存在");
        }

        return is;

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy