- 浏览: 2517 次
- 性别:
- 来自: 杭州
最新评论
文章列表
private static void channelCopy(ReadableByteChannel src,WritableByteChannel dest) throws IOException{
ByteBuffer buffer=ByteBuffer.allocate(10*1024);
while(src.read(buffer)!=-1){
buffer.flip();
while(buffer.hasRemaining()){
dest.write ...
channl 单向 和双向 记录1
- 博客分类:
- nio
channl
|
|
|-------------------------------|
ReadableByteChannel WritableByteChannel
...
1. 不能实现同步
每个对象有自己的锁。。。。、
public class ThreadTest extends Thread {
private int threadNo;
public ThreadTest(int threadNo) {
this.threadNo = threadNo;
}
public static void main(String[] args) throws Exception {
for (int i = 1; i < 10; i++) {
...