자바 filePutContents()

1 개요[ | ]

자바 filePutContents()
BufferedWriter bw = new BufferedWriter( new FileWriter( "test.txt" ) );
bw.write( "John Smith" );
bw.close();
PrintWriter pw = new PrintWriter( "test.txt" );
pw.println( "John Smith" );
pw.close();
PrintWriter pw = new PrintWriter( new FileWriter( "test.txt" ) );
pw.println( "John Smith" );
pw.close();

2 함수[ | ]

public static void filePutContents(String filename, String data) {
	filePutContents(filename, data, false);
}
public static void filePutContents(String filename, String data, boolean append) {
	try {
		BufferedWriter bw = new BufferedWriter( new FileWriter( filename, append ) );
		bw.write( data );
		bw.close();
	} catch (IOException e) {
		e.printStackTrace();
	}
}

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}