/* m3u8 파일 리딩 : URL */
import java.io.*;
public class TextFileReading
{
public static void main(String[] args){
StringBuffer sb = new StringBuffer();
FileReader readFile;
BufferedReader br;
String getLine;
try {
readFile = new FileReader("C:/1/1.txt"); // 파일경로
br = new BufferedReader(readFile);
String resultUrl = "";
while((getLine = br.readLine()) != null){ // 한줄씩 읽기 (마지막줄 체크)
System.out.println(getLine);
if(getLine.startsWith("http")){ // 파일중 http 로 시작하는 줄 찾아서 저장.
resultUrl = getLine;
}
}
System.out.println("URL :"+ resultUrl);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
'JAVA' 카테고리의 다른 글
자바에서의 인스턴스란? (0) | 2014.07.24 |
---|---|
3. 재생시간 구하기 최종.[결과본] (0) | 2014.07.23 |
1. URL 경로 파일 다운로드해서 TXT형 저장하기 (0) | 2014.07.23 |
[Java] 나머지 % (0) | 2014.06.01 |
Date (0) | 2014.02.01 |