You are on page 1of 5
‘osioar2024, 14:21 Java HO Tutorial - Java iO Search Website Home Java IO Tutorial - Java I/O HOME (rtputwwrava2s.com) Introduction Next» (0010_Java_jo File.) ava v0) Fite ava Fle (0010_sove_fFie.him) sava Fle Operation (0020_Java_io_Fi LATAM Ati: “Operationnim) . Garanta seu hotel Input Stream Java nputeam {0080__Jove fo. InpuSteam nm) Java FisinputSteam Java Inputfoutput (VO) deals with reading data from a source and writing data to a destination. {0100_Java_1o_Fiemputsveam nm) Java BerednpuStreams ‘Typically, we read data stored in a fle or write data toa fl using VO, (0110_ava_ jo Butereinptsvear tig Sous Pusttecaipatsvear “The java.io and java no packages contain Java classes that deal with lO (0120_Jove_fo_PushbackinpuSteem Hf java.io package has classes to perform I/O. Java DatalpuSream (0130_Java_o_DatanputStoam im) The java.nio package Is new IO package. The classes in the java.io package are all about the stream based JO operations. The stream- Output Stream save OutbutSteam based /O uses streams to transfer byte data between a data source and a Java program, (0200_ave.fo_Oufputstreamhn) The Java program reads from or writes to a stream a byte at a time. This approach to performing Java FieOutpuSteam ote a risouputsveam nny ¥_© 2Peratons is slow. A stream can be used for one-way data transfer. An input steam can only ‘hava PantSiream transfer data from a data source to a Java program and an output stream can only transfer data (0240_Java_jo_PrniSteam him) from a Java program to a data destination Java DataOuipsteam ne DataOuiputSiream hin] M® New InpuOuput(NIO) solves the slow speed problem in the strear-based lO, (0250_Java,| ava Pipe In NIO, we deal with channels and buffers for UO operations. (0300_tava_fo_Pipe.htm) ava Object Seralizaton A channel is lke a stream, It represents a connection between a data source and a Java {0400_sava_o_Object_Serialzaton.miBhogram, Reader Writer ‘A channel provides a two-way data transfer facility. We can use a channel to read data as well as Java Reader Wer to write data (0500_ove fe Reader ter") Wo can gptain a read-only channel, a write-only channel, or a road-write channel Random Access ‘Abufferis a bounded data container and has a fixed capacity that determines the upper mit of Java Random Accass Fos the data it may contain {0500_sava_lo_Random_Access_ Files.) in stream-based 1/0, we write data directly to the stream. In channel-based VO, we write data Stand Stream into a butfer and we pass that buffer to the channel, which writes the data to the data destination. ave Standard nowOuwEr When reading data from a data source, we pass a buffer toa channel. The channel reads data (0700_Java_jo_Standard_Input_utpul BARING da Reusee into a bulfer, Java Consol Java 7 introduced New Input/Output 2 API, which provides @ new VO API. It provides many (orn nvae.COmOKIN) ——_Featras that wor ach in he orignal Fe VO API (0730_sava_o_Seannechim) adds three packages to the Java class library: java.nio.file,java.nio file attribute, and ava Tokenizer java.rio.file sp. (Sa Sob Tan) New inpuvOutpu2API deals wt ate systems in a uilorm way. The fle system suppor Zip Jar provide by New npuvOutput2 PIs exon,

You might also like