public interface DataReader
Modifier and Type | Method and Description |
---|---|
ReadableByteChannel |
createChannel()
Create a sequential view of torrent's data in the form of a
ReadableByteChannel . |
ReadableByteChannel createChannel()
ReadableByteChannel
.
The returned channel's read(ByteBuffer)
method has the following behavior:
ByteBuffer data = ByteBuffer.allocate(TORRENT_SIZE); ByteBuffer buffer = ByteBuffer.allocate(8192); ReadableByteChannel ch = reader.createChannel(); while (ch.read(buffer) >= 0) { buffer.flip(); data.put(buffer); buffer.clear(); }
Copyright © 2016–2021. All rights reserved.