ÇÁ·Î±×·¡¹Ö

 3198, 1/160 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   ksbgenius
   [ÀÚ¹Ù]ÀÔÃâ·Â °ü·Ã ÇÁ·Î±×·¥

http://www.hackerschool.org/HS_Boards/zboard.php?AllArticle=true&no=3057 [º¹»ç]


import java.io.*;
import java.util.*;

public class DataStreamTest{
        public static void main(String[] args) throws IOException{
                DataInputStream in = null;
                DataOutputStream out = null;
        
                try{
                        System.out.println("¿øÇÏ´Â ¹øÈ£¸¦ ÀÔ·ÂÇϽÿÀ");
                        Scanner scan = new Scanner(System.in);
                        int a = scan.nextInt();
                        
                        int c;
                        out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("data.bin",false)));
                        out.writeUTF("È«±æµ¿ 011-111-1111 hong@hanmail.net");
                        out.writeUTF("±èÀ¯½Å 010-222-2222 kim@hanmail.net");
                        out.flush();
                        
                        
                        
                        in = new DataInputStream(new BufferedInputStream(new FileInputStream("data.bin")));
                if (a==1){
                        System.out.println(in.readUTF());
                }
                if(a!=1){
                        System.out.println(in.readUTF());
                        System.out.println(in.readUTF());
                }
                
        
                
                
                }
                finally{
                        if(in != null)
                                in.close();
                }
                
                if (out!=null){
                        out.close();
                }
                
                
        }
        }
À§ ¼Ò½º¿¡¼­ ó·³
¸¸¾à ¼ýÀÚ 1À» ´©¸£¸é Á¦°¡ ¿øÇÏ´Â °ÍÀº È«±æµ¿¿¡ °üÇÑ ³»¿ëÀÌ ³ª¿À°í
¼ýÀÚ 2¸¦ ´©¸£¸é ±èÀ¯½Å¿¡ °üÇÑ Á¤º¸¸¦ ³ª¿À°Ô ÇÏ°í ½ÍÀºµ¥ ±×°Ô Àß ¾ÈµÇ³×¿ä...
Á¶¾ðÀ» ºÎʵ右´Ï´Ù.

  Hit : 4653     Date : 2011/06/13 07:38