java.io.FileOutputStream.FileOutputStream()のサンプル

Javaコード

package com.arkgame;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileInputStreamDemo {

	public static void main(String[] args) {
		try (FileInputStream cftInFile = new FileInputStream("C:/cft/test001.txt");
				FileOutputStream cftOutFile = new FileOutputStream("C:/data/test001_copy.txt")) {
			int k;
			while ((k = cftInFile.read()) != -1) {
				cftOutFile.write((byte) k);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Java

Posted by arkgame