Technology/Programming
JAVA / 파일 읽어오기, 파일 입력 처리
Yonglae Cho
2011. 1. 14. 16:01
텍스트파일 입력
String 배열의 길이는 str.length 로 한다.
String file_path = 파일경로; File inFile = new File(file_path); if (inFile.exists()) { System.out.println("input file: " + file_path); BufferedReader ib = new BufferedReader(new FileReader(inFile)); String line = null; while ((line = ib.readLine()) != null) { // 파일 한줄을 읽어온다. line = line.trim(); String[] arr = line.split("\t"); if (arr.length == 2) { } } } else { // 파일이 존재 않는 다면.. }
String 배열의 길이는 str.length 로 한다.