SlideShare a Scribd company logo
Presented By:
Arif Ullah(2630)
Presented To:
Sir Fasee Ullah
ABASYN UNIVERSITY PESHAWAR
• Buffer :
• Introduction
• Stream
• Input & output buffered
• Example
• Scanner:
• Introduction
• Scanner class
• Methods
• Example
 The Java.io.BufferedReade class reads text from a character-input stream,
buffering characters so as to provide for the efficient reading of characters,
arrays, and lines. Following are the important points about Buffered
Reader:
 The buffer size may be specified, or the default size may be used.
 Each read request made of a Reader causes a corresponding read request
to be made of the underlying character or byte stream.
 A stream is a sequence of data. In Java a stream is composed of bytes. It's
called a stream because it's like a stream of water that continues to flow.
 Three streams are created for us automatically:
 1) System.out: standard output stream
 2) System.in: standard input stream
 3) System.err: standard error
 Input and Output in Java
Input and Output (I/O) is used to process the input
and produce the output based on the input. Java uses
the concept of stream to make I/O operations fast.
java.io package contains all the classes required for
input and output operations.
 Java application uses an output stream to write data to a destination, it may
be a file,an array,peripheral device or socket.
 Java application uses an input stream to read data from a source, it may be
a file,an array,peripheral device or socket.
 BufferedOutputStream used an internal buffer. It adds more efficiency than
to write data directly into a stream. So, it makes the performance fast.
 In the following example, we are writing the textual information in the Buffered
Output Stream object which is connected to the File Output Stream object. The
flush() flushes the data of one stream and send it into another. It is required if you
have connected the one stream with another.
• import java.io.*;
• class Test{
• public static void main(String args[])
• throws Exception{
• FileOutputStream fout=new FileOutputStream("f1.txt");
• BufferedOutputStream bout=new BufferedOutputStream(fout);
•
• String s="Sachin is my favourite player";
• byte b[]=s.getBytes();
• bout.write(b);
•
• bout.flush();
• bout.close();
• System.out.println("success");
• }
• }
• import java.io.*;
• class SimpleRead{
• public static void main(String args[]){
• try{
• FileInputStream fin=new FileInputStream("f1.txt");
• BufferedInputStream bin=new BufferedInputStream(fin);
• int i;
• while((i=bin.read())!=-1)
• System.out.println((char)i);
•
• fin.close();
• }
• catch(Exception e){system.out.println(e);}
• }
• }
• Output:Sachin is my favourite player
•
• Output:Sachin is my favourite player
 There are various ways to read input from the keyboard, the
java.util.Scanner class is one of them. The Scanner class breaks the
input into tokens using a delimiter which is whitespace bydefault. It
provides many methods to read and parse various primitive values.
 Allows the user to input the values of various types.
 Defined within a package java.util.
 import java.util.Scanner;
Creating scanner object
 Scanner sc = new Scanner(System.in);
 nextInt():
• receives the next token from scanner object which can be expressed as an
integer and stored in integer type
 nextFloat():
• receives the next token from scanner object which can be expressed as an
floating and stored in float type
 nextDouble():
• receives the next token from scanner object which can be expressed as an
double and stored in double type
 nextLine():
• receives the next line of the string
• package scanner;
• import java.util.Scanner;
• public class scannerDemo {
• void sum(int a, float b){
• double result=a+b;
• System.out.println("the sum is = "+result);
• }
• public static void main(String[] args){
• Scanner scanner=new Scanner(System.in);
• System.out.println("input integer value:");
• int num1=scanner.nextInt();
• System.out.println("input double value:");
• float num2=scanner.nextFloat();
• scannerDemo scannerDemo=new
scannerDemo();
• scannerDemo.sum(num1, num2);
• }
• }
• http://www.tutorialspoint.com/java/io/java_io_bufferedreader.htm
• http://www.slideshare.net/sonibabu/scanner-classes
• https://www.facebook.com/javatpoint
• http://www.javatpoint.com/cloud-computing-tutorial
Buffer and scanner
Ad

More Related Content

What's hot (20)

Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
Strings in Java
Strings in JavaStrings in Java
Strings in Java
Abhilash Nair
 
Operators and Expressions in Java
Operators and Expressions in JavaOperators and Expressions in Java
Operators and Expressions in Java
Abhilash Nair
 
Java Basics
Java BasicsJava Basics
Java Basics
shivamgarg_nitj
 
Control structures in java
Control structures in javaControl structures in java
Control structures in java
VINOTH R
 
Java Strings
Java StringsJava Strings
Java Strings
RaBiya Chaudhry
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 
Exception Handling in JAVA
Exception Handling in JAVAException Handling in JAVA
Exception Handling in JAVA
SURIT DATTA
 
Java I/O
Java I/OJava I/O
Java I/O
Jussi Pohjolainen
 
Static keyword ppt
Static keyword pptStatic keyword ppt
Static keyword ppt
Vinod Kumar
 
Exception Handling
Exception HandlingException Handling
Exception Handling
Reddhi Basu
 
Method overloading
Method overloadingMethod overloading
Method overloading
Lovely Professional University
 
C++ Memory Management
C++ Memory ManagementC++ Memory Management
C++ Memory Management
Rahul Jamwal
 
Polymorphism In Java
Polymorphism In JavaPolymorphism In Java
Polymorphism In Java
Spotle.ai
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
Nilesh Dalvi
 
String in java
String in javaString in java
String in java
Ideal Eyes Business College
 
Operators in java
Operators in javaOperators in java
Operators in java
Then Murugeshwari
 
C by balaguruswami - e.balagurusamy
C   by balaguruswami - e.balagurusamyC   by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
Srichandan Sobhanayak
 
Java Method, Static Block
Java Method, Static BlockJava Method, Static Block
Java Method, Static Block
Infoviaan Technologies
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
BHUVIJAYAVELU
 

Viewers also liked (15)

X$Tables And Sga Scanner, DOAG2009
X$Tables And Sga Scanner, DOAG2009X$Tables And Sga Scanner, DOAG2009
X$Tables And Sga Scanner, DOAG2009
Frank
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Harmeet Singh(Taara)
 
java: basics, user input, data type, constructor
java:  basics, user input, data type, constructorjava:  basics, user input, data type, constructor
java: basics, user input, data type, constructor
Shivam Singhal
 
Define location of Preplaced cells(http://www.vlsisystemdesign.com/PD-Flow.php)
Define location of Preplaced cells(http://www.vlsisystemdesign.com/PD-Flow.php)Define location of Preplaced cells(http://www.vlsisystemdesign.com/PD-Flow.php)
Define location of Preplaced cells(http://www.vlsisystemdesign.com/PD-Flow.php)
VLSI SYSTEM Design
 
1 java - data type
1  java - data type1  java - data type
1 java - data type
vinay arora
 
ppt on scanner class
ppt on scanner classppt on scanner class
ppt on scanner class
deepsxn
 
Jnp
JnpJnp
Jnp
hj43us
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
Shahjahan Samoon
 
Esoft Metro Campus - Certificate in java basics
Esoft Metro Campus - Certificate in java basicsEsoft Metro Campus - Certificate in java basics
Esoft Metro Campus - Certificate in java basics
Rasan Samarasinghe
 
Object-Oriented Analysis and Design
Object-Oriented Analysis and DesignObject-Oriented Analysis and Design
Object-Oriented Analysis and Design
RiazAhmad786
 
Structured Vs, Object Oriented Analysis and Design
Structured Vs, Object Oriented Analysis and DesignStructured Vs, Object Oriented Analysis and Design
Structured Vs, Object Oriented Analysis and Design
Motaz Saad
 
automated teller machines
automated teller  machinesautomated teller  machines
automated teller machines
tejinderubs
 
10 Slides to ATM
10 Slides to ATM10 Slides to ATM
10 Slides to ATM
seanraz
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
Haitham El-Ghareeb
 
Atm System
Atm SystemAtm System
Atm System
Nila Kamal Nayak
 
X$Tables And Sga Scanner, DOAG2009
X$Tables And Sga Scanner, DOAG2009X$Tables And Sga Scanner, DOAG2009
X$Tables And Sga Scanner, DOAG2009
Frank
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Harmeet Singh(Taara)
 
java: basics, user input, data type, constructor
java:  basics, user input, data type, constructorjava:  basics, user input, data type, constructor
java: basics, user input, data type, constructor
Shivam Singhal
 
Define location of Preplaced cells(http://www.vlsisystemdesign.com/PD-Flow.php)
Define location of Preplaced cells(http://www.vlsisystemdesign.com/PD-Flow.php)Define location of Preplaced cells(http://www.vlsisystemdesign.com/PD-Flow.php)
Define location of Preplaced cells(http://www.vlsisystemdesign.com/PD-Flow.php)
VLSI SYSTEM Design
 
1 java - data type
1  java - data type1  java - data type
1 java - data type
vinay arora
 
ppt on scanner class
ppt on scanner classppt on scanner class
ppt on scanner class
deepsxn
 
Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
Shahjahan Samoon
 
Esoft Metro Campus - Certificate in java basics
Esoft Metro Campus - Certificate in java basicsEsoft Metro Campus - Certificate in java basics
Esoft Metro Campus - Certificate in java basics
Rasan Samarasinghe
 
Object-Oriented Analysis and Design
Object-Oriented Analysis and DesignObject-Oriented Analysis and Design
Object-Oriented Analysis and Design
RiazAhmad786
 
Structured Vs, Object Oriented Analysis and Design
Structured Vs, Object Oriented Analysis and DesignStructured Vs, Object Oriented Analysis and Design
Structured Vs, Object Oriented Analysis and Design
Motaz Saad
 
automated teller machines
automated teller  machinesautomated teller  machines
automated teller machines
tejinderubs
 
10 Slides to ATM
10 Slides to ATM10 Slides to ATM
10 Slides to ATM
seanraz
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
Haitham El-Ghareeb
 
Ad

Similar to Buffer and scanner (20)

Java development development Files lectur6.ppt
Java development development Files lectur6.pptJava development development Files lectur6.ppt
Java development development Files lectur6.ppt
rafeakrafeak
 
Files io
Files ioFiles io
Files io
Narayana Swamy
 
Java I/O
Java I/OJava I/O
Java I/O
Jayant Dalvi
 
L21 io streams
L21 io streamsL21 io streams
L21 io streams
teach4uin
 
JAVA (UNIT 3)
JAVA (UNIT 3)JAVA (UNIT 3)
JAVA (UNIT 3)
Dr. SURBHI SAROHA
 
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
 
Computer science input and output BASICS.pptx
Computer science input and output BASICS.pptxComputer science input and output BASICS.pptx
Computer science input and output BASICS.pptx
RathanMB
 
IOstreams hgjhsgfdjyggckhgckhjxfhbuvobunciu
IOstreams hgjhsgfdjyggckhgckhjxfhbuvobunciuIOstreams hgjhsgfdjyggckhgckhjxfhbuvobunciu
IOstreams hgjhsgfdjyggckhgckhjxfhbuvobunciu
akinbhattarai1
 
Java Wrapper Classes and I/O Mechanisms
Java Wrapper Classes and I/O MechanismsJava Wrapper Classes and I/O Mechanisms
Java Wrapper Classes and I/O Mechanisms
Subhadra Sundar Chakraborty
 
Stream In Java.pptx
Stream In Java.pptxStream In Java.pptx
Stream In Java.pptx
ssuser9d7049
 
Unit IV Notes.docx
Unit IV Notes.docxUnit IV Notes.docx
Unit IV Notes.docx
GayathriRHICETCSESTA
 
Oodp mod4
Oodp mod4Oodp mod4
Oodp mod4
cs19club
 
CHAPTER 5 mechanical engineeringasaaa.pptx
CHAPTER 5 mechanical engineeringasaaa.pptxCHAPTER 5 mechanical engineeringasaaa.pptx
CHAPTER 5 mechanical engineeringasaaa.pptx
SadhilAggarwal
 
Using Input Output
Using Input OutputUsing Input Output
Using Input Output
raksharao
 
CSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdfCSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdf
VithalReddy3
 
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptxChapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
noonoboom
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptx
cherryreddygannu
 
Java stream
Java streamJava stream
Java stream
Arati Gadgil
 
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
 
What is java input and output stream?
What is java input and output stream?What is java input and output stream?
What is java input and output stream?
kanchanmahajan23
 
Java development development Files lectur6.ppt
Java development development Files lectur6.pptJava development development Files lectur6.ppt
Java development development Files lectur6.ppt
rafeakrafeak
 
L21 io streams
L21 io streamsL21 io streams
L21 io streams
teach4uin
 
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
 
Computer science input and output BASICS.pptx
Computer science input and output BASICS.pptxComputer science input and output BASICS.pptx
Computer science input and output BASICS.pptx
RathanMB
 
IOstreams hgjhsgfdjyggckhgckhjxfhbuvobunciu
IOstreams hgjhsgfdjyggckhgckhjxfhbuvobunciuIOstreams hgjhsgfdjyggckhgckhjxfhbuvobunciu
IOstreams hgjhsgfdjyggckhgckhjxfhbuvobunciu
akinbhattarai1
 
Stream In Java.pptx
Stream In Java.pptxStream In Java.pptx
Stream In Java.pptx
ssuser9d7049
 
CHAPTER 5 mechanical engineeringasaaa.pptx
CHAPTER 5 mechanical engineeringasaaa.pptxCHAPTER 5 mechanical engineeringasaaa.pptx
CHAPTER 5 mechanical engineeringasaaa.pptx
SadhilAggarwal
 
Using Input Output
Using Input OutputUsing Input Output
Using Input Output
raksharao
 
CSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdfCSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdf
VithalReddy3
 
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptxChapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
Chapter 13_m5JAVANOTESAPPLETS,INPUT.pptx
noonoboom
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptx
cherryreddygannu
 
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
 
What is java input and output stream?
What is java input and output stream?What is java input and output stream?
What is java input and output stream?
kanchanmahajan23
 
Ad

Recently uploaded (20)

Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 

Buffer and scanner

  • 1. Presented By: Arif Ullah(2630) Presented To: Sir Fasee Ullah ABASYN UNIVERSITY PESHAWAR
  • 2. • Buffer : • Introduction • Stream • Input & output buffered • Example • Scanner: • Introduction • Scanner class • Methods • Example
  • 3.  The Java.io.BufferedReade class reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. Following are the important points about Buffered Reader:  The buffer size may be specified, or the default size may be used.  Each read request made of a Reader causes a corresponding read request to be made of the underlying character or byte stream.
  • 4.  A stream is a sequence of data. In Java a stream is composed of bytes. It's called a stream because it's like a stream of water that continues to flow.  Three streams are created for us automatically:  1) System.out: standard output stream  2) System.in: standard input stream  3) System.err: standard error  Input and Output in Java Input and Output (I/O) is used to process the input and produce the output based on the input. Java uses the concept of stream to make I/O operations fast. java.io package contains all the classes required for input and output operations.
  • 5.  Java application uses an output stream to write data to a destination, it may be a file,an array,peripheral device or socket.
  • 6.  Java application uses an input stream to read data from a source, it may be a file,an array,peripheral device or socket.
  • 7.  BufferedOutputStream used an internal buffer. It adds more efficiency than to write data directly into a stream. So, it makes the performance fast.  In the following example, we are writing the textual information in the Buffered Output Stream object which is connected to the File Output Stream object. The flush() flushes the data of one stream and send it into another. It is required if you have connected the one stream with another.
  • 8. • import java.io.*; • class Test{ • public static void main(String args[]) • throws Exception{ • FileOutputStream fout=new FileOutputStream("f1.txt"); • BufferedOutputStream bout=new BufferedOutputStream(fout); • • String s="Sachin is my favourite player"; • byte b[]=s.getBytes(); • bout.write(b); • • bout.flush(); • bout.close(); • System.out.println("success"); • } • }
  • 9. • import java.io.*; • class SimpleRead{ • public static void main(String args[]){ • try{ • FileInputStream fin=new FileInputStream("f1.txt"); • BufferedInputStream bin=new BufferedInputStream(fin); • int i; • while((i=bin.read())!=-1) • System.out.println((char)i); • • fin.close(); • } • catch(Exception e){system.out.println(e);} • } • } • Output:Sachin is my favourite player • • Output:Sachin is my favourite player
  • 10.  There are various ways to read input from the keyboard, the java.util.Scanner class is one of them. The Scanner class breaks the input into tokens using a delimiter which is whitespace bydefault. It provides many methods to read and parse various primitive values.  Allows the user to input the values of various types.  Defined within a package java.util.
  • 11.  import java.util.Scanner; Creating scanner object  Scanner sc = new Scanner(System.in);
  • 12.  nextInt(): • receives the next token from scanner object which can be expressed as an integer and stored in integer type  nextFloat(): • receives the next token from scanner object which can be expressed as an floating and stored in float type
  • 13.  nextDouble(): • receives the next token from scanner object which can be expressed as an double and stored in double type  nextLine(): • receives the next line of the string
  • 14. • package scanner; • import java.util.Scanner; • public class scannerDemo { • void sum(int a, float b){ • double result=a+b; • System.out.println("the sum is = "+result); • } • public static void main(String[] args){ • Scanner scanner=new Scanner(System.in); • System.out.println("input integer value:"); • int num1=scanner.nextInt(); • System.out.println("input double value:"); • float num2=scanner.nextFloat(); • scannerDemo scannerDemo=new scannerDemo(); • scannerDemo.sum(num1, num2); • } • }
  • 15. • http://www.tutorialspoint.com/java/io/java_io_bufferedreader.htm • http://www.slideshare.net/sonibabu/scanner-classes • https://www.facebook.com/javatpoint • http://www.javatpoint.com/cloud-computing-tutorial