文件名称:IO流的使用,自己的心得
文件大小:6KB
文件格式:JAVA
更新时间:2012-03-26 07:13:32
I/O流
/**
* 用缓存的字节入做写入操作
*
*/
@Test
public void testOutPut(){
String filePath = "F://test1.txt";
String writeString = "testOutPut:1231";
int tempLength = 2;
StringBuffer bs = new StringBuffer();
int each = 0;
try {
ops = new FileOutputStream(filePath);
byte writeStringToBytes[] = writeString.getBytes();
byte temp[] = new byte[tempLength];
//需要几次写入
if(writeStringToBytes.length%tempLength==0)
each = writeStringToBytes.length/tempLength;
else
each = writeStringToBytes.length/tempLength+1;
//每一次写入流
for(int i=0;i