Skip to content

파일 입출력

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();
	}
	
}

프로그래머 역사

2016.12.

  • HTML을 배우다
  • SQL을 접하다

2017.2.

  • CSS를 접하다
  • JSP를 접하다

2017.7.

  • PHP를 접하다

2017.9.

  • Java를 접하다
  • SQL을 배우다

2018.4.

  • ASP를 접하다
  • Java를 배우다

2018.12.

  • 대학(컴퓨터공학전공) 입시 불합격

2019.2.

  • Java를 공부하다
Clone this wiki locally