📄 a2zfilewriter.java
字号:
/* Daniel Shiffman *//* Programming from A to Z *//* Spring 2006 *//* http://www.shiffman.net *//* daniel.shiffman@nyu.edu */package a2z;import java.io.FileOutputStream;import java.io.IOException;import java.nio.ByteBuffer;import java.nio.channels.FileChannel;public class A2ZFileWriter { private String filename; public A2ZFileWriter(String name) { filename = name; } public void writeContent(String content) throws IOException { // Create an output stream and file channel // Using second argument as file name to write out FileOutputStream fos = new FileOutputStream(filename); FileChannel outfc = fos.getChannel(); // Convert content String into ByteBuffer and write out to file ByteBuffer bb = ByteBuffer.wrap(content.getBytes()); //outfc.position(0); outfc.write(bb); outfc.close(); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -