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();
}
}
}
點(diǎn)擊加載更多評(píng)論>>