Class NullByteOutput
java.lang.Object
cool.scx.io.NullByteOutput
- All Implemented Interfaces:
ByteOutput, AutoCloseable
NullByteOutput
- Version:
- 0.0.1
- Author:
- scx567888
-
Constructor Details
-
NullByteOutput
public NullByteOutput()
-
-
Method Details
-
write
- Specified by:
writein interfaceByteOutput- Throws:
AlreadyClosedException
-
write
- Specified by:
writein interfaceByteOutput- Throws:
AlreadyClosedException
-
flush
- Specified by:
flushin interfaceByteOutput- Throws:
AlreadyClosedException
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceByteOutput
-
close
Description copied from interface:ByteOutput关闭此流, 并执行与关闭相关的所有必要行为.
close() 不只是单纯的关闭操作: 在某些实现中, close() 可能触发额外的有意义动作, 例如:
- 刷新缓冲区或输出最终数据
- 发送或接收协议结束标志
- 写入校验、尾块或元数据
- 提交事务性状态
- 释放底层系统资源
正因为 close() 可能包含这些只能发生一次的行为, 所以此处 close() 设计为一次性操作,而非幂等操作. 若流已关闭, 重复调用 close() 属非法调用, 将抛出 AlreadyClosedException.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceByteOutput- Throws:
AlreadyClosedException
-