Out输出对象clear(),clearBuffer()和flush()的区别

本文详细解释了Out对象的clear、clearBuffer和flush方法的区别及使用场景,帮助开发者更好地掌握Out对象的缓冲区管理。
clear:


As the name implies, the clear method of out object is used to clear the output buffer. This method does not write any contents to the client. An exception is thrown by this method if the buffer was flushed.


General syntax of clear method of out object is as follows:
out.clear();


clearBuffer:
The clearBuffer method of out object is used to clear the output buffer. This method does not write any contents to the client.


The only difference between the clear method of out object and clearBuffer method is
clear method throws an exception when the buffer is flushed.
clearBuffer method does not throw an exception when the buffer is flushed.
General syntax of clearBuffer method of out object is as follows:
out.clearBuffer();


flush:
Two methods of out object, clear and clearBuffer are used to clear the output buffer without writing any contents to the client. If you wish to flush the buffer and write contents to the client, then you can use the flush method of out object. The flush method of out object is used to flush the buffer by writing the contents to the client.


General syntax of flush method of out object is as follows:

out.flush();


参考文章:http://blog.sina.com.cn/s/blog_73cdc7a601018xhx.html

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值