<pre class="java" name="code">/*
ByteArrayStream 的用法,操作字节流
*/
package byteArrayStreamDemo;
import java.io.*;
class ByteArrayStreamDemo
{
public static void main(String[] args)
{
ByteArrayInputStream bais=new ByteArrayInputStream("abcde".getBytes());
ByteArrayOutputStream baos=new ByteArrayOutputStream();
int by=0;
while((by=bais.read())!=-1)
{
baos.write(by);
}
System.out.println(baos.size());
System.out.println(baos.toString());
}
}
ByteArrayStream
最新推荐文章于 2024-08-26 17:47:58 发布