Okio

核心类

image-20211112153532976
  • BufferedSource类似InputStream负责读取数据。

  • BufferedSink类似OutputStream负责写入数据。

读取分析

读取代码示例:

流程图

source()

buffer()

indexOf()

commonIndexOf()

Buffer的创建

readUtf8Line()

commonReadUtf8Line()

readUtf8()

readString()

commonReadByteArray()

commonReadFully()

read()

commonRead()

写入分析

image-20211112181419165

sink()

buffer()

writeUtf8()

commonWriteUtf8()

write()

commonWriteUtf8()

emitCompleteSegments()

commonEmitCompleteSegments()

completeSegmentByteCount()

commonCompleteSegmentByteCount()

write()

参考

最后更新于