java

자바에서의 입출력

imj2y 2008. 6. 3. 19:56

1byte 출력
1) 콘솔출력
FileOutputStream fos =- new FileOutputStream(FileDescriptor.out);
BufferdOutputStream bos = new BufferdOutputSTream(fos);
DataOutputStream dos = new DataOutputStream(bos);
dos.write(...);

2) 파일 출력용
 File file = new File("파일명");
 FileOutputStream fos = new FileOutputStream(file);
 BufferdOutputStream bos = new BufferdOutputStream(fos);
 DataOutputStream dos = new DateOutputStream(bos);
 dos.write();
 
 3) 네트워크 출력
 Soket soc = new Socket(...);
 BufferdOutputStream bos = new BufferdOutputStream(soc.getOutputStream());
 DataOutputStream dos = new DataOutputStream(bos);
 dos.write(...)

2byte 출력
1) 콘솔 출력
OutputStreamWriter osw = new OutputStreamWriter(System.out);
BufferdWriter bw = new VufferedWriter(osw);
PrintWriter pw = new PrintWriter(bw);
pw.println(...);

2) 파일 출력
File file = new File("파일명");
FileWirter fw = new FileWriter(file);
BufferdWriter bw = new BufferedWriter(fw);
PrintWirter pw = new PrintWriter(bw);
pw.println(...);

3) 네트워크 출력
Socket soc = new Socket(...);
OutputStreamWriter osw = new OutputSTreamWriter(soc.getOutputStreamj());
BurfferedWriter bw = new BufferedWriter(osw);
PrintWriter pw = new PrintWriter(bw);
pw.println(...);