GGYU

Input/OutputStream 본문

프로그래밍/JAVA

Input/OutputStream

GANADARA 2018. 7. 19. 21:20

try {

InputStream a = new  FileInputStream("C:\\mytext.txt");

 byte[] buffer = new byte[BUFFER_SIZE];

while(true){

int i = a.read(buffer);

System.out.println("hi : " + i);

if ( i == -1 ) break;

}

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}


OutputStream  a = new FileOutputStream("C:\\mytext.txt")  ;

try {

String b = "행복하단. 그런 말을 하고 있었으면서.";

byte[] c = b.getBytes();

a.write(c);

} catch (Exception e) {

}

'프로그래밍 > JAVA' 카테고리의 다른 글

thread 사용법  (0) 2018.07.19
threadpool 사용법  (0) 2018.07.19
디렉토리 조회  (0) 2018.07.19
BufferedReader/Writer 사용법  (0) 2018.07.19
LineNumberReader 사용법  (0) 2018.07.19
Comments