-
Notifications
You must be signed in to change notification settings - Fork 0
파일 입출력
Im Sejin edited this page Mar 13, 2019
·
2 revisions
package practice.io;
import java.io.*;
public class ReaderClass {
String path = null;
public ReaderClass(String path) {
this.path = path;
}
public String read() throws IOException {
BufferedReader br = new BufferedReader(new FileReader(path));
String text = "";
while(true) {
String line = br.readLine();
if(line == null) break;
text += line + "\r\n";
}
br.close();
return text;
}
public void readByte() throws IOException {
FileInputStream fis = new FileInputStream(path);
byte[] b = new byte[1024];
fis.read(b);
System.out.println(new String(b));
fis.close();
}
}