아래 소스에 대하여 설명좀 부탁드려요 뭐가 어떻게 되는건지.... 초보자라서 모르는게 많네요
import java.io.*;
public class File7{
public static void main(String[] args) throws Exception{
File f=new File("c:\\알파벳.txt");
FileInputStream fis=new FileInputStream(f);
int len=(int)f.length(); // 파일의 크기는 long이므로 int로 형 변환한다.
byte[] b=new byte[len]; // 파일의 크기만큼 배열을 잡는다.
fis.read(b); // 파일로부터 데이터를 모두 읽어와 b에 기억시킨다.
fis.close();
for(int i=0;i<b.length;i++) // 출력
System.out.print((char)b[i]);
}
}
|