Java OutputStream类案例
OutputStream类
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
//OutputStream类
public class OutputStreamDemo {
public static void main(String[] args) {
try {
File inputFile = new File("Date.json");
File outputFile = new File("output.json");
InputStream inputStream = new FileInputStream(inputFile);
OutputStream outputStream = new FileOutputStream(outputFile);
int i = 0;
while(i != 0) {
i = inputStream.read();
outputStream.wait(i);
}
inputStream.close();
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
点击加载更多评论>>