www.updatesofts.com
!
"
+
&
public static void main(String args[ ]) throws IOException
{
// defining sequence input stream
SequenceInputStream Seq3;
FileInputStream Fis 1 ;
Fisl = new FileInputStream("byteexam.java");
FileInputStream Fis2;
Fis2= new FileInputStream("fileioexam.java");
Seq3 = new SequenceInputStream(Fisl, Fis2);
// create buffered input and output streams
BufferedInputStream inst;
inst .= new BufferedInputStream(Seq3);
BufferedOutputStream oust;
oust= new BufferedOutputStream(System.out);
inst.skip(lOOO);
boolean eof = false;
int bytcnt = 0;
while(!eof)
{
int num = inst.read();
if(num = = -1)
{
eof =true;
}
else
{
oust.write((char) num);
+ + bytcnt;
}
}
String
bytrd
,=
String.valueOf(bytcnt);
bytrd + = "bytes were read";
oust.write(bytrd.getBytes(). 0, bytrd.length());
//
close
all
streams.
inst.close();
oust.close();
Fisl.close();
Fis2.close();
}
}
Hình 9.3 hiện kết xuất của chương trình trên: