728x90 반응형 study/Java305 [Java] 36. IO (Runtime.getRuntime, exec) package chap15; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; /* 다른프로세스에서 전달받은 데이터를 콘솔에 출력하기 * 멀티프로세스 : 여러개의 프로그램을 동시에 실행. * 프로세스(Process) : 실행 중인 다른 프로그램. * * Runtime.getRuntime() : OS로부터 프로세스를 실행할 권한 얻음. * exec() : 프로그램 실행. 프로세스실행 */ public class ProcessEx1 { public static void main(String[] args) throws IOException { Process p = Runtime.getRuntime().exec.. 2022. 4. 1. [Java] 36. IO 출력스트림 (Writer, OutputStreamWriter) package chap15; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; /* * Writer : 문자형출력스트림. 1char 단위로 (write)출력 * write(int) : 2바이트(1char)출력 * * OutputStreamWriter : 문자형출력 2022. 4. 1. [Java] 36. IO 출력스트림 (OutputStream) package chap15; import java.io.IOException; import java.io.OutputStream; /* * OutputStream : 바이트형 출력스트림. 1바이트단위로 (write)출력 * write(int) => 1바이트만 출력 */ public class OutputStreamEx1 { public static void main(String[] args) throws IOException{ OutputStream out = System.out; out.write('1');out.write('2');out.write('3'); out.write('a');out.write('b');out.write('c'); out.write('가');out.write('나');out... 2022. 4. 1. [Java] 36. IO 입력스트림 (Reader, InputStreamReader) package chap15; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; /* * Reader : 문자형 입력스트림. 1char(2바이트)단위로 읽기 * InputStreamReader : 문자형 입력스트림 2022. 4. 1. 이전 1 2 3 4 5 6 7 8 ··· 77 다음 728x90 반응형