Java NIO 非阻塞輸入/輸出的實作入門:解析通道
Channel 與緩衝區
ByteBuffer 與串流
InputStream/
OutputStream 的差異,如何使用
FileChannel 進行讀寫、透過
position()/
truncate() 做定位與長度調整、操作緩衝區參數(
capacity、
limit、
position、
mark),以及在
allocate() 與
allocateDirect() 之間做選擇。也展示了 zero-copy 操作
transferTo()/
transferFrom(),以及常見失誤,例如忘記呼叫
flip() 或使用了錯誤的緩衝區模式。