资源描述:
《外文翻译java io 系统》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、外文翻译(英文)TheJavaI/OSystemCreatingagoodinput/output(I/O)systemisoneofthemoredifficulttasksforalanguagedesigner.Thisisevidencedbythenumberofdifferentapproaches.Thechallengeseemstobeincoveringallpossibilities.NotonlyaretheredifferentsourcesandsinksofI/Othatyouwanttocommunicate
2、with(files,theconsole,networkconnections,etc.),butyouneedtotalktotheminawidevarietyofways(sequential,random-access,buffered,binary,character,bylines,bywords,etc.).TheJavalibrarydesignersattackedthisproblembycreatinglotsofclasses.Infact,therearesomanyclassesforJava’sI/Osyst
3、emthatitcanbeintimidatingatfirst(ironically,theJavaI/Odesignactuallypreventsanexplosionofclasses).TherewasalsoasignificantchangeintheI/OlibraryafterJavai.o,whentheoriginalbyte-orientedlibrarywassupplementedwithchar-oriented,Unicode-basedI/Oclasses.Thenioclasses(for"newI/O,
4、"anamewe’llstillbeusingyearsfromnoweventhoughtheywereintroducedinJDK1.4andsoarealready"old")wereaddedforimprovedperformanceandfunctionality.Asaresult,thereareafairnumberofclassestolearnbeforeyouunderstandenoughofJava’sI/Opicturethatyoucanuseitproperly.Inaddition,it’srather
5、importanttounderstandtheevolutionoftheI/Olibrary,evenifyourfirstreactionis"Don’tbothermewithhistory,justshowmehowtouseit!"Theproblemisthatwithoutthehistoricalperspective,youwillrapidlybecomeconfusedwithsomeoftheclassesandwhenyoushouldandshouldn’tusethem.InputandoutputProgr
6、amminglanguageI/Olibrariesoftenusetheabstractionofastream,whichrepresentsanydatasourceorsinkasanobjectcapableofproducingorreceivingpiecesofdata.ThestreamhidesthedetailsofwhathappenstothedatainsidetheactualI/Odevice.TheJavalibraryclassesforI/Oaredividedbyinputandoutput,asyo
7、ucanseebylookingattheclasshierarchyintheJDKdocumentation.Throughinheritance,everythingderivedfromtheInputStreamorReaderclasseshasbasicmethodscalledread()forreadingasinglebyteoranarrayofbytes.Likewise,everythingderivedfromOutputStreamorWriterclasseshasbasicmethodscalledwrit
8、e()forwritingasinglebyteoranarrayofbytes.However,youwon’tgenerallyusethesemethods;theyexi