(1):试试用下面这个函数
public final void writeUTF(String str) throws IOException
Writes a string to the file using UTF-8 encoding in a machine-independent manner.
First, two bytes are written to the file, starting at the current file pointer, as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the UTF-8 encoding for each character.(2):每一次写入文件指针都会往后移,所以想继续写入,执行write函数就可以的。
public final void writeUTF(String str) throws IOException
Writes a string to the file using UTF-8 encoding in a machine-independent manner.
First, two bytes are written to the file, starting at the current file pointer, as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the UTF-8 encoding for each character.(2):每一次写入文件指针都会往后移,所以想继续写入,执行write函数就可以的。
解决方案 »
- 急*急 ** 读取大数据量的文件,插入到数据库内存溢出
- [讨论贴]JDK的目录文件、工具功能简介和技巧征集,我牵头,大牛们来完善(想发200分的帖子不让发)
- 各位大虾!请指点指点!
- 为什么java中不需要类似于C、C++中的.h文件呢?? 50分
- 如何实现持续以日期为文件名用FileWriter输出日志文件?
- 利用jtree动态创建jtable的问题
- 求助 如何让jText只能输入1-100的数字。
- 关于applet和socket
- 新手的一个简单问题~
- 为什么我用jbuilder6集成weblogic6.1。编译项目时提示没有weblogic_sp.jar
- 關于Java 調試﹗
- 请问文件的读写类FileWriter和RandomAccessFile的优缺点在哪里,
str = str +"/r/n";
str =new String(str.getBytes("UFT-8"),"UFT-8");
RandomAccessFile logFile = new RandomAccessFile("C:\\UInfo.log","rw");
logFile.seek(logFile.length());
logFile.writeBytes();