能够合并字节输入流的流:SequenceInputStream
构造:SequenceInputStream sis=new SequenceInputStream(new FileInputStream(src1),new FileInputStream(src2));合并多个字节输入流:Vector<InputStream> v=new Vector<>();
Enumeration<InputStream> en=v.elements();SequenceInputStream sis=new SequenceInputStream(en);
解决字节读取字符数据乱码问题。ByteArrayOutputStream baos=new ByteArrayOutputStream();
FileInputStream fis=new FileInputStram(src);byte[] bys=new byte[3];int len=0;whie((len=fis.read(bys))!=-1){baos.write(bys,0,len);}sop(baos.toString());fis.close();//baos.close();不需要关闭,因为它并没有和硬盘上的文件有直接关联,它只是把读取到的内容放在了缓冲区里,
|
|