개발하자/JAVA중급
파일내용 읽어오기(한글)
i구야
2015. 1. 31. 10:45
class A {
public static void main(String args[]) throws Exception {
FileInputStream fis = new FileInputStream("c:/aaa/b.txt");
byte[] buffer=new byte[fis.available()];
fis.read(buffer);
System.out.print(new String(buffer));
}
}
ex) 바이트수 반환
class A {
public static void main(String args[]) throws Exception {
FileInputStream fis = new FileInputStream("c:/aaa/b.txt");
byte[] buffer=new byte[fis.available()];
int n=fis.read(buffer); //전체 바이트 수를 반환
System.out.print(n);
}
}