티스토리 뷰
package robot_bbs_insert;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
public class ReadFile {
public static String DIR_NAME = "D:\\bet365\\";
public static String FILE_NAME = "baseball.txt";
public void readFiles(String dir) throws Exception {
File dirFile=new File(dir);
String [] filenames = dirFile.list();
for(String filename:filenames) {
System.out.println(filename);
}
}
public void readFile(String dirFile) throws Exception {
//BufferedReader in =new BufferedReader(new FileReader(dirFile));
//한글깨질때
FileInputStream input=new FileInputStream(dirFile);
InputStreamReader reader=new InputStreamReader(input, "UTF-8");
BufferedReader in=new BufferedReader(reader);
String str;
StringBuffer response=new StringBuffer();
while((str=in.readLine()) != null) {
response.append(str);
}
in.close();
String html=response.toString();
System.out.println(html);
}
public static void main(String[] args){
System.out.println("시작");
try {
ReadFile rf=new ReadFile();
//rf.readFiles(DIR_NAME);
rf.readFile(DIR_NAME+FILE_NAME);
}catch(Exception e) {
e.printStackTrace();
}
System.out.println("끝");
}
}
'자바(Java) > 자바 로봇 프로그래밍' 카테고리의 다른 글
[자바 파싱] bet365 devtools에서 소스 복사해서 클립보드에 넣기 (0) | 2024.07.25 |
---|---|
자바 마우스 포인터 위치 얻기 (0) | 2024.07.25 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 인포믹스
- 스크래핑
- 플러터
- ocajp
- MySQL
- php
- proc
- xe애드온
- C언어
- esql
- KG
- EC
- xe addon
- 이클립스
- 파싱
- XE
- JDBC
- 포인터
- 자바
- 프로씨
- 라이믹스 모듈
- C
- Python
- XE3
- 오라클
- webix
- ocjap
- 파이썬
- 문자열
- 자바 smtp
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함