[试题]

( 11 )请在下列程序的空白处,填上适当的内容:

Import java. awt. *;

Import java. util. *;

C.lass BufferTest{

Public static void main(string args[])

Throws IOException{

F.ileOutputStream unbuf=

new FileOutputStream( “ test.one ” ) ;

B.ufferedOutputStream buf=

new ( 11 ) (new FileOutputStream( “ test.two ” ));

System.out.println( “ write file unbuffered: ” + time(unbuf) + “ ms ” );

System.out.println( “ write file buffered: ” + time(buf) + “ ms ” );

}

Static int time (OutputStream os)

Throws IOException{

D.ate then = new Date();

for (int i=0; i<50000; i++){

os.write(1);

}

}

os.close();

return(int)(()new Date()).getTime() - then.getTime());

}

参考答案与解析: