你确定不是这样?{:soso_e100:}
- import java.io.ByteArrayInputStream;
- import java.io.ByteArrayOutputStream;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.OutputStreamWriter;
- public class DD {
- /**
- * @param args
- * @throws IOException
- * @throws FileNotFoundException
- */
- public static void main(String[] args) throws FileNotFoundException, IOException {
- ByteArrayOutputStream bo= new ByteArrayOutputStream();
- ByteArrayInputStream bs= new ByteArrayInputStream("haha".getBytes());//传东西
- byte[] buf=new byte[1024*1024];//byte搞的略大
- int len=0;
- while((len=bs.read(buf))!=-1)
- {
- bo.write(buf,0,len);
- bo.writeTo(new FileOutputStream("E:\\FastCAM.avi"));//这里是个file 格式怎么却是avi
- }
- bs.close();
- System.out.println(bo.size());
- }
- }
复制代码
|