SlideShare a Scribd company logo
What is Java input and output stream?
What is Java input and output stream?
Java I/O (Input and Output) is used to process the feedback and produce the
outcome based on the feedback.
Java uses the idea of circulation to make I/O function fast. The java.io package
contains all the sessions required for feedback and outcome functions.
file handling in java can be performed by java IO API.
Stream
A stream is a series of information. In Java stream is comprised of bytes. Like a
water flow stream; it is called a stream as it continues with the flow .
In java, 3 sources are created for you instantly. All these sources are connected
with system.
1) Program.out: conventional output stream
2) Program.in: conventional input stream
3) Program.err: conventional error stream
OutputStream
Java program uses an outcome circulation to write information to a location, it
may be a knowledge file,an range,peripheral system or outlet.
InputStream
Java program uses a port circulation to read information from a source, it may
be a knowledge file,an range,peripheral system or outlet.
OutputStream class
OutputStream class is a subjective category.It is the superclass of all sessions
comprising an outcome stream of bytes. An output stream allows output bytes
and delivers them to some sink.
1) public void write(int)throws IOException: current output stream will contain
byte due to this code
2) public void write(byte[])throws IOException: current output stream will
contain an array of byte due to this code
3) public void flush()throws IOException: clears out the current output stream
4) public void close()throws IOException: closure of the current output stream
InputStream class
InputStream class is an subjective category. It is the superclass of all sessions
comprising a port stream of bytes.
1) public abstract int read()throws IOException: returns -1 at the end of the file
and it reads the next byte of data from the input stream.
2) public int available()throws IOException: number of readable bytes from
the current input stream can be estimated
3) public void close()throws IOException: closure of the current input stream
Java File Output Stream class
Java File Output Stream is an outcome flow for composing information to a data
file.
If you have to create basic principles then use FileOutputStream.Instead, for
character-oriented information, choose FileWriter.But you can create byte-
oriented as well as character-oriented information.
Example of Java FileOutputStream class
1. import java.io.*;
2. class Test{
3. public static void main(String args[]){
4. try{
5. FileOutputstream fout=new FileOutputStream(“abc.txt”);
6. String s=”Sachin Tendulkar is my favourite player”;
7. byte b[]=s.getBytes();//converting string into byte array
8. fout.write(b);
9. fout.close();
10. System.out.println(“success…”);
11. }catch(Exception e){system.out.println(e);}
12. }
13.}
Java File Input Stream class
Java File Input Stream category acquires feedback bytes from a data file.It is
used for studying sources of raw bytes such as picture information. For
studying sources of figures, consider using FileReader.
It should be used to study byte-oriented information for example to read
picture, sound, movie etc.
Example of FileInputStream class
1. import java.io.*;
2. class SimpleRead{
3. public static void main(String args[]){
4. try{
5. FileInputStream fin=new FileInputStream(“abc.txt”);
6. int i=0;
7. while((i=fin.read())!=-1){
8. System.out.println((char)i);
9. }
10. fin.close();
11. }catch(Exception e){system.out.println(e);}
12. }
13.}
Example of Reading the information of current Java information file and
writing it into another file
We can read the information of information file using the File Input Stream class
whether it is Java information file, image information file, video information file
etc. In this example, we are reading the information of C.java information file
and writing it into another information file M.java.
import java.io.*;
1. class C{
2. public static void main(String args[])throws Exception{
3. FileInputStream fin=new FileInputStream(“C.java”);
4. FileOutputStream fout=new FileOutputStream(“M.java”);
5. int i=0;
6. while((i=fin.read())!=-1){
7. fout.write((byte)i);
8. }
9. fin.close();
10.}
11.}
You can join the training institute in Java to make your profession in this
field.
Java-Reviews of CRB Solutions is sufficient to make you consider and take up
a career in this field.
Ad

More Related Content

What's hot (20)

Java stream
Java streamJava stream
Java stream
Arati Gadgil
 
Java I/o streams
Java I/o streamsJava I/o streams
Java I/o streams
Hamid Ghorbani
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Java
JavaJava
Java
Dhruv Sabalpara
 
Handling I/O in Java
Handling I/O in JavaHandling I/O in Java
Handling I/O in Java
Hiranya Jayathilaka
 
IO In Java
IO In JavaIO In Java
IO In Java
parag
 
CORE JAVA-1
CORE JAVA-1CORE JAVA-1
CORE JAVA-1
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Character stream classes introd .51
Character stream classes introd  .51Character stream classes introd  .51
Character stream classes introd .51
myrajendra
 
Nhap xuat trong java
Nhap xuat trong javaNhap xuat trong java
Nhap xuat trong java
tuhn
 
File Input & Output
File Input & OutputFile Input & Output
File Input & Output
PRN USM
 
Java I/O
Java I/OJava I/O
Java I/O
Jussi Pohjolainen
 
Various io stream classes .47
Various io stream classes .47Various io stream classes .47
Various io stream classes .47
myrajendra
 
Chapter 10.3
Chapter 10.3Chapter 10.3
Chapter 10.3
sotlsoc
 
Chapter 12 - File Input and Output
Chapter 12 - File Input and OutputChapter 12 - File Input and Output
Chapter 12 - File Input and Output
Eduardo Bergavera
 
Oodp mod4
Oodp mod4Oodp mod4
Oodp mod4
cs19club
 
Java program file I/O
Java program file I/OJava program file I/O
Java program file I/O
Nem Sothea
 
Itp 120 Chapt 19 2009 Binary Input & Output
Itp 120 Chapt 19 2009 Binary Input & OutputItp 120 Chapt 19 2009 Binary Input & Output
Itp 120 Chapt 19 2009 Binary Input & Output
phanleson
 
Java Input Output and File Handling
Java Input Output and File HandlingJava Input Output and File Handling
Java Input Output and File Handling
Sunil OS
 
[Java] #7 - Input & Output Stream
[Java] #7 - Input & Output Stream[Java] #7 - Input & Output Stream
[Java] #7 - Input & Output Stream
Ghadeer AlHasan
 
File handling
File handlingFile handling
File handling
Amber Wajid
 

Similar to What is java input and output stream? (20)

File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptx
cherryreddygannu
 
Input output files in java
Input output files in javaInput output files in java
Input output files in java
Kavitha713564
 
Java - File Input Output Concepts
Java - File Input Output ConceptsJava - File Input Output Concepts
Java - File Input Output Concepts
Victer Paul
 
File Handling.pptx
File Handling.pptxFile Handling.pptx
File Handling.pptx
PragatiSutar4
 
File Handling in Java.pdf
File Handling in Java.pdfFile Handling in Java.pdf
File Handling in Java.pdf
SudhanshiBakre1
 
Unit IV Notes.docx
Unit IV Notes.docxUnit IV Notes.docx
Unit IV Notes.docx
GayathriRHICETCSESTA
 
UNIT4-IO,Generics,String Handling.pdf Notes
UNIT4-IO,Generics,String Handling.pdf NotesUNIT4-IO,Generics,String Handling.pdf Notes
UNIT4-IO,Generics,String Handling.pdf Notes
SakkaravarthiS1
 
Java IO Stream, the introduction to Streams
Java IO Stream, the introduction to StreamsJava IO Stream, the introduction to Streams
Java IO Stream, the introduction to Streams
ranganadh6
 
H U F F M A N Algorithm Class
H U F F M A N Algorithm ClassH U F F M A N Algorithm Class
H U F F M A N Algorithm Class
Jade Danial
 
IO Programming.pptx all informatiyon ppt
IO Programming.pptx all informatiyon pptIO Programming.pptx all informatiyon ppt
IO Programming.pptx all informatiyon ppt
nandinimakwana22cse
 
Input/Output Exploring java.io
Input/Output Exploring java.ioInput/Output Exploring java.io
Input/Output Exploring java.io
NilaNila16
 
1.26 File Input-Output in JAVA.pptx
1.26 File Input-Output in JAVA.pptx1.26 File Input-Output in JAVA.pptx
1.26 File Input-Output in JAVA.pptx
YashrajMohrir
 
Iostreams
IostreamsIostreams
Iostreams
aptechsravan
 
Io Streams
Io StreamsIo Streams
Io Streams
phanleson
 
Basic i/o & file handling in java
Basic i/o & file handling in javaBasic i/o & file handling in java
Basic i/o & file handling in java
JayasankarPR2
 
IO Streams, Serialization, de-serialization, autoboxing
IO Streams, Serialization, de-serialization, autoboxingIO Streams, Serialization, de-serialization, autoboxing
IO Streams, Serialization, de-serialization, autoboxing
Gurpreet singh
 
Java Day-6
Java Day-6Java Day-6
Java Day-6
People Strategists
 
Buffer and scanner
Buffer and scannerBuffer and scanner
Buffer and scanner
Arif Ullah
 
JAVA
JAVAJAVA
JAVA
LOVELY PROFESSIONAL UNIVERSITY
 
11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf
11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf
11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf
hungvidien123
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptx
cherryreddygannu
 
Input output files in java
Input output files in javaInput output files in java
Input output files in java
Kavitha713564
 
Java - File Input Output Concepts
Java - File Input Output ConceptsJava - File Input Output Concepts
Java - File Input Output Concepts
Victer Paul
 
File Handling in Java.pdf
File Handling in Java.pdfFile Handling in Java.pdf
File Handling in Java.pdf
SudhanshiBakre1
 
UNIT4-IO,Generics,String Handling.pdf Notes
UNIT4-IO,Generics,String Handling.pdf NotesUNIT4-IO,Generics,String Handling.pdf Notes
UNIT4-IO,Generics,String Handling.pdf Notes
SakkaravarthiS1
 
Java IO Stream, the introduction to Streams
Java IO Stream, the introduction to StreamsJava IO Stream, the introduction to Streams
Java IO Stream, the introduction to Streams
ranganadh6
 
H U F F M A N Algorithm Class
H U F F M A N Algorithm ClassH U F F M A N Algorithm Class
H U F F M A N Algorithm Class
Jade Danial
 
IO Programming.pptx all informatiyon ppt
IO Programming.pptx all informatiyon pptIO Programming.pptx all informatiyon ppt
IO Programming.pptx all informatiyon ppt
nandinimakwana22cse
 
Input/Output Exploring java.io
Input/Output Exploring java.ioInput/Output Exploring java.io
Input/Output Exploring java.io
NilaNila16
 
1.26 File Input-Output in JAVA.pptx
1.26 File Input-Output in JAVA.pptx1.26 File Input-Output in JAVA.pptx
1.26 File Input-Output in JAVA.pptx
YashrajMohrir
 
Basic i/o & file handling in java
Basic i/o & file handling in javaBasic i/o & file handling in java
Basic i/o & file handling in java
JayasankarPR2
 
IO Streams, Serialization, de-serialization, autoboxing
IO Streams, Serialization, de-serialization, autoboxingIO Streams, Serialization, de-serialization, autoboxing
IO Streams, Serialization, de-serialization, autoboxing
Gurpreet singh
 
Buffer and scanner
Buffer and scannerBuffer and scanner
Buffer and scanner
Arif Ullah
 
11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf
11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf
11_Str11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.11_Streams.eams.pdf
hungvidien123
 
Ad

Recently uploaded (20)

YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdfExploring-Substances-Acidic-Basic-and-Neutral.pdf
Exploring-Substances-Acidic-Basic-and-Neutral.pdf
Sandeep Swamy
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Ad

What is java input and output stream?

  • 1. What is Java input and output stream? What is Java input and output stream? Java I/O (Input and Output) is used to process the feedback and produce the outcome based on the feedback. Java uses the idea of circulation to make I/O function fast. The java.io package contains all the sessions required for feedback and outcome functions. file handling in java can be performed by java IO API. Stream A stream is a series of information. In Java stream is comprised of bytes. Like a water flow stream; it is called a stream as it continues with the flow . In java, 3 sources are created for you instantly. All these sources are connected with system. 1) Program.out: conventional output stream 2) Program.in: conventional input stream 3) Program.err: conventional error stream OutputStream Java program uses an outcome circulation to write information to a location, it may be a knowledge file,an range,peripheral system or outlet. InputStream Java program uses a port circulation to read information from a source, it may be a knowledge file,an range,peripheral system or outlet.
  • 2. OutputStream class OutputStream class is a subjective category.It is the superclass of all sessions comprising an outcome stream of bytes. An output stream allows output bytes and delivers them to some sink. 1) public void write(int)throws IOException: current output stream will contain byte due to this code 2) public void write(byte[])throws IOException: current output stream will contain an array of byte due to this code 3) public void flush()throws IOException: clears out the current output stream 4) public void close()throws IOException: closure of the current output stream InputStream class InputStream class is an subjective category. It is the superclass of all sessions comprising a port stream of bytes. 1) public abstract int read()throws IOException: returns -1 at the end of the file and it reads the next byte of data from the input stream. 2) public int available()throws IOException: number of readable bytes from the current input stream can be estimated 3) public void close()throws IOException: closure of the current input stream Java File Output Stream class Java File Output Stream is an outcome flow for composing information to a data file. If you have to create basic principles then use FileOutputStream.Instead, for character-oriented information, choose FileWriter.But you can create byte- oriented as well as character-oriented information.
  • 3. Example of Java FileOutputStream class 1. import java.io.*; 2. class Test{ 3. public static void main(String args[]){ 4. try{ 5. FileOutputstream fout=new FileOutputStream(“abc.txt”); 6. String s=”Sachin Tendulkar is my favourite player”; 7. byte b[]=s.getBytes();//converting string into byte array 8. fout.write(b); 9. fout.close(); 10. System.out.println(“success…”); 11. }catch(Exception e){system.out.println(e);} 12. } 13.} Java File Input Stream class Java File Input Stream category acquires feedback bytes from a data file.It is used for studying sources of raw bytes such as picture information. For studying sources of figures, consider using FileReader. It should be used to study byte-oriented information for example to read
  • 4. picture, sound, movie etc. Example of FileInputStream class 1. import java.io.*; 2. class SimpleRead{ 3. public static void main(String args[]){ 4. try{ 5. FileInputStream fin=new FileInputStream(“abc.txt”); 6. int i=0; 7. while((i=fin.read())!=-1){ 8. System.out.println((char)i); 9. } 10. fin.close(); 11. }catch(Exception e){system.out.println(e);} 12. } 13.} Example of Reading the information of current Java information file and writing it into another file We can read the information of information file using the File Input Stream class
  • 5. whether it is Java information file, image information file, video information file etc. In this example, we are reading the information of C.java information file and writing it into another information file M.java. import java.io.*; 1. class C{ 2. public static void main(String args[])throws Exception{ 3. FileInputStream fin=new FileInputStream(“C.java”); 4. FileOutputStream fout=new FileOutputStream(“M.java”); 5. int i=0; 6. while((i=fin.read())!=-1){ 7. fout.write((byte)i); 8. } 9. fin.close(); 10.} 11.} You can join the training institute in Java to make your profession in this field. Java-Reviews of CRB Solutions is sufficient to make you consider and take up a career in this field.