标题记录demo
文件本地读取上传
package com.example.demo;
import java.io.*;
public class FILE {
public static void main(String[] args) throws IOException {
//输入地址
String loadPath = “D:\testwan.pdf”;
//数出地址
String outPath = “D:\testwan2.pdf”;
//输入溜
InputStream in = new FileInputStream(new File(loadPath));
//输出溜
FileOutputStream out = new FileOutputStream(new File(outPath));
//创建缓冲区
byte[] buffer = new byte[1024];
int readNumber = 0;
while ((readNumber = in.read(buffer)) != -1) {
out.write(buffer, 0, readNumber);// 读取并输出buffer数组里面0~n个字节
}
in.close();
out.close();
}
}