Package org.aoju.bus.core.io.source
Interface Source
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Subinterfaces:
BufferSource
- All Known Implementing Classes:
AssignSource,Buffer,GzipSource,InflaterSource,PeekSource,RealSource
提供一个字节流 使用此接口从任何地方读取数据 它的位置:来自网络、存储或内存中的缓冲区 来源可能 分层以转换提供的数据,例如解压、解密或移除协议框架
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
-
Method Details
-
read
从中删除至少1个字节,最多为byteCount字节, 并将它们 附加到sink。返回读取的字节数,如果该源已耗尽,则返回-1- Parameters:
sink- 缓冲byteCount- 长度大小- Returns:
- the long
- Throws:
IOException-IOExceptionIOException.
-
timeout
-
close
关闭此源并释放此源持有的资源. 读取闭源是一个错误。多次关闭源是安全的.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException-IOExceptionIOException.
-