接口
interface IOStream
__
public interface IOStream <: InputStream & OutputStream {}
功能:输入输出流接口。
父类型:
- InputStream
- OutputStream
interface InputStream
__
public interface InputStream {
func read(buffer: Array\<Byte\>): Int64
}
功能:输入流接口。
func read(Array<Byte>)
__
func read(buffer: Array\<Byte\>): Int64
功能:从输入流中读取数据放到 buffer
中。
参数:
返回值:
- Int64 - 读取的数据的字节数。
interface OutputStream
__
public interface OutputStream {
func write(buffer: Array\<Byte\>): Unit
func flush(): Unit
}
功能:输出流接口。
func flush()
__
func flush(): Unit
功能:清空缓存区。该函数提供默认实现,默认实现为空。
func write(Array<Byte>)
__
func write(buffer: Array\<Byte\>): Unit
功能:将 buffer
中的数据写入到输出流中。
参数:
interface Seekable
__
public interface Seekable {
prop length: Int64
prop position: Int64
prop remainLength: Int64
func seek(sp: SeekPosition): Int64
}
功能:移动光标接口。
prop length
__
prop length: Int64
功能:返回当前流中的总数据量。
类型:Int64
prop position
__
prop position: Int64
功能:返回当前光标位置。
类型:Int64
prop remainLength
__
prop remainLength: Int64
功能:返回当前流中未读的数据量。
类型:Int64
func seek(SeekPosition)
__
func seek(sp: SeekPosition): Int64
功能:移动光标到指定的位置。
参数:
- sp: SeekPosition - 指定光标移动后的位置。
返回值:
- Int64 - 返回流中数据的起点到移动后位置的偏移量(以字节为单位)。