星期三, 二月 08, 2006

Java的NIO

基本NIO读取代码
FileInputStream fin = new FileInputStream("c:\\1.txt");
FileChannel fc = fin.getChannel();
ByteBuffer buffer = ByteBuffer.allocate(1024);
while(r!=-1)
{
buffer.clear();
r = fc.read(buffer);
System.out.println(r);
}

参考资料:
https://www6.software.ibm.com/developerworks/cn/education/java/j-nio/tutorial/index.html

tag:java,nio

0 Comments:

发表评论

<< Home