这个方法就是保存文件用的了 调裤液陵用saveFile(file.getInputStrean,file.getName)
private void saveFile(InputStream inputStream, String fileName) {OutputStream os = null try {
String path = "D:\\testFile\\" // 2、保存到临时文件 // 1K的数据缓冲
byte[] bs = new byte[1024] // 读取到的数胡戚据长度
int len // 输出的文件流保存到本地文件
File tempFile = new File(path) if (!tempFile.exists()) {
tempFile.mkdirs()
}
os = new FileOutputStream(tempFile.getPath() + File.separator + fileName) // 开始读取
埋稿 while ((len = inputStream.read(bs)) != -1) {
os.write(bs, 0, len)
}
} catch (IOException e) {
e.printStackTrace()
} catch (Exception e) {
e.printStackTrace()
} finally { // 完毕,关闭所有链接
try {
os.close()
inputStream.close()
} catch (IOException e) {
e.printStackTrace()
}
}
}
bookstrap插件下载方式如下:1、访问Bootstrap下载网站(此处以V3版本肢或进禅枯行介绍)点击下载。
2、保存到本地,解压文件。
3、打开文件,将里面的文件全贺饥洞部复制到软件中。
4、IDEA要复制到web目录下。
5、Bootstrap依赖于jQuery库,使用Bootstrap之前要下载jQuery库。
6、导入Bootstrap和jQuery。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)