18luck򲻿

֪оCBInsightsշذ桶2018ؿ˹ơTopAITrendsToWatchIn2018AIҵչ״оҪöҪͳIOvsNIOȣ1DzFileInputStreamȡļݵģpublicstaticvoidmethod2(){????InputStreamin=null;????try{??????in=newBufferedInputStream(newFileInputStream("src/nomal_io.txt"));???????byte[]buf=newbyte[1024];??????intbytesRead=in.read(buf);??????while(bytesRead!=-1)??????{????????for(inti=0;i??????????System.out.print((char)buf[i]);????????bytesRead=in.read(buf);??????}????}catch(IOExceptione)????{??????e.printStackTrace();????}finally{??????try{????????if(in!=null){??????????in.close();????????}??????}catch(IOExceptione){????????e.printStackTrace();??????}????}??}ԣǶӦNIOͨRandomAccessFileвȻҲͨFileInputStream.getChannel()вpublicstaticvoidmethod1(){????RandomAccessFileaFile=null;????try{??????aFile=newRandomAccessFile("src/nio.txt","rw");??????FileChannelfileChannel=aFile.getChannel();??????ByteBufferbuf=ByteBuffer.allocate(1024);???????intbytesRead=fileChannel.read(buf);??????System.out.println(bytesRead);???????while(bytesRead!=-1)??????{????????buf.flip();????????while(buf.hasRemaining())????????{??????????System.out.print((char)buf.get());????????}?????????buf.compact();????????bytesRead=fileChannel.read(buf);??????}????}catch(IOExceptione){??????e.printStackTrace();????}finally{??????try{????????if(aFile!=null){??????????aFile.close();????????}??????}catch(IOExceptione){????????e.printStackTrace();??????}????}??}ԣͨϸԱȰ1Ͱ2ӦܿţܷNIOʵַʽȽиӡCalosʱߺĻСջϲõѡ

学科分类 - 工学 - 计算机科学与技术

一流学科建设高校

点击加载更多>>

合作伙伴友情链接

教育部 神州学人 千人计划 教育部科技发展中心 人力资源和社会保障部 海外高层次人才 中国就业网 全日本中国人博士协会

广告合作:赵佳+86-13810238612E-mail:zhaojia@eol.cn

内容合作:肖琳+86-10-82159101-8083E-mail:xiaol@eol.cn