반응형
    
    
    
  뭐 여러가지 방법이 있겠지만
                    
        
그 안의 절차를 살펴보죠
import java.io.*;
public class Foo {
  public static void main(String[] args) {
    if (args.length == 0) {                   // args.length 는 옵션 개수
      System.err.println("Input Filename...");
      System.exit(1);                         // 읽을 파일명을 주지 않았을 때는 종료
    }
    String outFilename = args[0] + ".uni";    // 출력 파일명 만들기, uni 라는 확장자를 붙여서
    try {
      ////////////////////////////////////////////////////////////////
      BufferedReader in = new BufferedReader(
                                             new InputStreamReader(
                                                                   new FileInputStream(args[0]),
                                                                   "MS949"
                                                                   )
                                             );
      BufferedWriter out = new BufferedWriter(
                                              new OutputStreamWriter(
                                                                     new FileOutputStream(outFilename),
                                                                     "UTF-8"
                                                                     )
                                              );
      String s;
      while ((s = in.readLine()) != null) {
        out.write(s); out.newLine();
      }
      in.close(); out.close();
      ////////////////////////////////////////////////////////////////
    } catch (IOException e) {
        System.err.println(e); // 에러가 있다면 메시지 출력
        System.exit(1);
    }
  }
}
반응형
    
    
    
  '개발도 하냐?' 카테고리의 다른 글
| 여러분은 몇개 회사나 알고 계신가요? (0) | 2011.02.11 | 
|---|---|
| 레오나르도 다빈치의 수기노트 설계도 (0) | 2011.01.23 | 
| BOM (31) | 2011.01.18 | 
| 장하준 - 그들이 말하지 않는 23가지 (0) | 2010.12.27 | 
| 모바일웹서비스를 위한 브라우저탐지 (0) | 2010.11.26 |