public class FileInputStreamHangul {
public static void main(String[] args) throws IOException {
String path = FileInputStreamHangul.class.getResource("test2.txt").getPath();
InputStream inputStream = new FileInputStream(path);
int readByte = 0;
byte[] readBytes = new byte[3];
while((readByte= inputStream.read(readBytes))!=-1){
System.out.println("읽은 바이트 수 : " + readByte);
String string = new String(readBytes);
System.out.println("읽은 문자: " + string);
}
inputStream.close();
}
}
댓글 영역