public class FileUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
void |
downloadByStream(javax.servlet.http.HttpServletResponse response,
File file)
将指定文件通过流下载
|
void |
downloadByUrl(String fileUrl,
String fileName,
String savePath)
从网络Url中下载文件
|
byte[] |
getBytes(File file)
获取文件的Byte数组
|
String |
getExtension(String fileName)
获取文件拓展名
|
static FileUtil |
of()
生成FileUtil实例
|
byte[] |
readInputStream(InputStream inputStream)
从输入流中获取字节数组
|
boolean |
writeFile(byte[] bytes,
File file)
将字节数组写入文件
|
public static FileUtil of()
public void downloadByUrl(String fileUrl, String fileName, String savePath)
fileUrl - 文件URL地址fileName - 文件名savePath - 保存的地址public void downloadByStream(javax.servlet.http.HttpServletResponse response,
File file)
response - responsefile - 文件public byte[] getBytes(File file)
file - 文件public boolean writeFile(byte[] bytes,
File file)
bytes - 要写入的字节数组file - 文件public byte[] readInputStream(InputStream inputStream)
inputStream - 输入流Copyright © 2019. All rights reserved.