SlideShare a Scribd company logo
1 of 4
Download to read offline
Core Java

Debasish Pratihari

Concept of Stream :




In file processing, input refers to the flow of
data into a program and output means the flow
of data out of the program.
Java uses the concept of streams to represent
the ordered sequence of data. A stream
presents a uniform, easy-to-use, object-oriented
interface between the program and the
input/output devices. A stream in java is a path
along which data flows. It has a source and a
destination and it supports unidirectional
movement of data.

Note :
Streams can be
visualized as a sequence
of data.

Input/Output Operations
Keyboard

Screen
Printer

Mouse
Memory

Java
Program

Memory

Disk

Disk

Network

Network

Streams in Java

Note :

Java streams are classified into two basic types
 InputStream
 OutputStream
 InputStream extract (i.e reads) data from the
source (file) and sends it to the program.
 OutputStream takes data from the program and
sends(i.e writes) it to the destination (file).


Lecture/core/io/23

1

 Stream is often
equipped with a
buffer in memory.
 A buffer is simply a
block of memory
that is used to batch
up the data that is
transferred to from
an external device.

feel the Technology…
Core Java

Debasish Pratihari

Stream Classes

The java.io package contains a large number of
stream classes that provides capabilities for
processing all types of data. These classes may be
organized into two groups depending upon the data
type they operate.
 Byte Stream Classes
 Character Stream Classes

Byte Stream Classes
Byte Stream Classes have been designed to provide
functional features for creating and manipulating stream
and files for reading and writing bytes. Since the streams
are unidirectional, they can transmit bytes in only one
direction and therefore java provides two kinds of byte
stream classes : InputStream and OutputStream classes.
InputStream Classes
Input stream classes that are used to read 8-bit (I byte)
include a super class know as InputStream and number of
sub-classes for supporting various input-related functions.

Program Architecture of File Copy Program

ins Stream
Input.txt

read( )

inFile

Program

Output.txt
outFile

Lecture/core/io/23

write( )
outs Stream

2

feel the Technology…
Core Java

Debasish Pratihari

Sample Program-1

Program Objective : To Copy Characters from one File to
another.
File Name : CopyChars.java

import java.io.*;
class CopyChars{
public static void main(String args[]){
File inFile = new File("Input.txt");
File outFile = new File("Output.txt");
FileReader ins= null;
FileWriter outs=null;
try{
ins= new FileReader(inFile);
outs=new FileWriter(outFile);
int ch;
while((ch=ins.read())!= -1)
outs.write(ch);
}catch(IOException e){
System.out.println(e);
System.exit(0);
}
finally{
try{
ins.close();
outs.close();
}catch(IOException e){
System.out.println(e);
}
}
}
}

Lecture/core/io/23

3

feel the Technology…
Core Java

Debasish Pratihari

Programming Architecture to Deal with Primitive Data type :
Bytes are read
from the file

Bytes are converted
to primitive types

fis

Primitive Types are
read from dis

dis

prim.txt

Program

Screen

primitive
fos

Bytes are written
to the file

dos

Primitives are converted
to a sequence of bytes

Primitive Types are
written to dos

Sample Prohram-2
25%
Program Objective : To deal with primitive Data types
File Name : PrimitiveDemo.java
import java.io.*;
class PrimitiveDemo{
public static void main(String args[]) throws IOException{
File primitive = new File("prim.txt");
FileOutputStream fos = new FileOutputStream(primitive);
DataOutputStream dos=new DataOutputStream(fos);
dos.writeInt(1234);
dos.writeDouble(34.45);
dos.writeBoolean(false);
dos.writeChar('a');
dos.close();
fos.close();
FileInputStream fis=new FileInputStream(primitive);
DataInputStream dis=new DataInputStream(fis);
System.out.println(dis.readInt());
System.out.println(dis.readDouble());
System.out.println(dis.readBoolean());
System.out.println(dis.readChar());
dis.close();
fis.close();
}
}

Lecture/core/io/23

4

feel the Technology…

More Related Content

What's hot

Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streamsShahjahan Samoon
 
Byte stream classes.49
Byte stream classes.49Byte stream classes.49
Byte stream classes.49myrajendra
 
Java Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsJava Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsAnton Keks
 
Character stream classes introd .51
Character stream classes introd  .51Character stream classes introd  .51
Character stream classes introd .51myrajendra
 
java.io - streams and files
java.io - streams and filesjava.io - streams and files
java.io - streams and filesMarcello Thiry
 
Character stream classes .52
Character stream classes .52Character stream classes .52
Character stream classes .52myrajendra
 
Java Input Output (java.io.*)
Java Input Output (java.io.*)Java Input Output (java.io.*)
Java Input Output (java.io.*)Om Ganesh
 
L21 io streams
L21 io streamsL21 io streams
L21 io streamsteach4uin
 
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 javaJayasankarPR2
 
IO In Java
IO In JavaIO In Java
IO In Javaparag
 
Java Input and Output
Java Input and OutputJava Input and Output
Java Input and OutputDucat India
 
Python reading and writing files
Python reading and writing filesPython reading and writing files
Python reading and writing filesMukesh Tekwani
 

What's hot (20)

Understanding java streams
Understanding java streamsUnderstanding java streams
Understanding java streams
 
Jstreams
JstreamsJstreams
Jstreams
 
Byte stream classes.49
Byte stream classes.49Byte stream classes.49
Byte stream classes.49
 
Java Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsJava Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and Streams
 
Character stream classes introd .51
Character stream classes introd  .51Character stream classes introd  .51
Character stream classes introd .51
 
Java stream
Java streamJava stream
Java stream
 
java.io - streams and files
java.io - streams and filesjava.io - streams and files
java.io - streams and files
 
Character stream classes .52
Character stream classes .52Character stream classes .52
Character stream classes .52
 
Oodp mod4
Oodp mod4Oodp mod4
Oodp mod4
 
Java Input Output (java.io.*)
Java Input Output (java.io.*)Java Input Output (java.io.*)
Java Input Output (java.io.*)
 
Io streams
Io streamsIo streams
Io streams
 
Java I/o streams
Java I/o streamsJava I/o streams
Java I/o streams
 
L21 io streams
L21 io streamsL21 io streams
L21 io streams
 
Java stereams
Java stereamsJava stereams
Java stereams
 
Io Streams
Io StreamsIo Streams
Io Streams
 
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
 
Java IO
Java IOJava IO
Java IO
 
IO In Java
IO In JavaIO In Java
IO In Java
 
Java Input and Output
Java Input and OutputJava Input and Output
Java Input and Output
 
Python reading and writing files
Python reading and writing filesPython reading and writing files
Python reading and writing files
 

Viewers also liked

Google既有商業模式的破壞者3
Google既有商業模式的破壞者3Google既有商業模式的破壞者3
Google既有商業模式的破壞者3guestc1eec3
 
Niver Flavia - 26.08.07
Niver Flavia - 26.08.07Niver Flavia - 26.08.07
Niver Flavia - 26.08.07Jubrac Jacui
 
Pedalando - 09.12.07
Pedalando - 09.12.07Pedalando - 09.12.07
Pedalando - 09.12.07Jubrac Jacui
 
javaday 2006 - Tiger
javaday 2006 - Tigerjavaday 2006 - Tiger
javaday 2006 - TigerMatteo Baccan
 
Ficha de Dados Pessoais 2010 6º ano
Ficha de Dados Pessoais 2010 6º anoFicha de Dados Pessoais 2010 6º ano
Ficha de Dados Pessoais 2010 6º anoNelson Silva
 
Javaday 2009 php e java
Javaday 2009 php e javaJavaday 2009 php e java
Javaday 2009 php e javaMatteo Baccan
 
Systems engineering leidraad se gww door ms
Systems engineering leidraad se gww door msSystems engineering leidraad se gww door ms
Systems engineering leidraad se gww door msMarcel Seijner
 
Social Care e-learning from Learning Pool & Ophira
Social Care e-learning from Learning Pool & OphiraSocial Care e-learning from Learning Pool & Ophira
Social Care e-learning from Learning Pool & OphiraPaul McElvaney
 
عرض ملتقى النهائي جديد
عرض ملتقى النهائي جديدعرض ملتقى النهائي جديد
عرض ملتقى النهائي جديدsabah alharby
 
Donn DeBoard Customer Journey Maps: Visualizing an engaging customer experien...
Donn DeBoard Customer Journey Maps: Visualizing an engaging customer experien...Donn DeBoard Customer Journey Maps: Visualizing an engaging customer experien...
Donn DeBoard Customer Journey Maps: Visualizing an engaging customer experien...ddeboard
 
Training in Tough Times
Training in Tough TimesTraining in Tough Times
Training in Tough TimesPaul McElvaney
 
Workshop Summer Academy
Workshop Summer AcademyWorkshop Summer Academy
Workshop Summer AcademySjef Kerkhofs
 
Confsl 2010 Facebook Framework
Confsl 2010 Facebook FrameworkConfsl 2010 Facebook Framework
Confsl 2010 Facebook FrameworkMatteo Baccan
 
A History Of Salento Colombia
A History Of Salento ColombiaA History Of Salento Colombia
A History Of Salento ColombiaSergio Pino
 
Lcu14 wrap up meeting. Summary of Core Develoment teams achievements
Lcu14 wrap up meeting. Summary of Core Develoment teams achievementsLcu14 wrap up meeting. Summary of Core Develoment teams achievements
Lcu14 wrap up meeting. Summary of Core Develoment teams achievementsAgustin Benito Bethencourt
 

Viewers also liked (20)

Para Que Serve O Galego
Para Que Serve O GalegoPara Que Serve O Galego
Para Que Serve O Galego
 
Google既有商業模式的破壞者3
Google既有商業模式的破壞者3Google既有商業模式的破壞者3
Google既有商業模式的破壞者3
 
Niver Flavia - 26.08.07
Niver Flavia - 26.08.07Niver Flavia - 26.08.07
Niver Flavia - 26.08.07
 
Pedalando - 09.12.07
Pedalando - 09.12.07Pedalando - 09.12.07
Pedalando - 09.12.07
 
javaday 2006 - Tiger
javaday 2006 - Tigerjavaday 2006 - Tiger
javaday 2006 - Tiger
 
Ficha de Dados Pessoais 2010 6º ano
Ficha de Dados Pessoais 2010 6º anoFicha de Dados Pessoais 2010 6º ano
Ficha de Dados Pessoais 2010 6º ano
 
Javaday 2009 php e java
Javaday 2009 php e javaJavaday 2009 php e java
Javaday 2009 php e java
 
Systems engineering leidraad se gww door ms
Systems engineering leidraad se gww door msSystems engineering leidraad se gww door ms
Systems engineering leidraad se gww door ms
 
Social Care e-learning from Learning Pool & Ophira
Social Care e-learning from Learning Pool & OphiraSocial Care e-learning from Learning Pool & Ophira
Social Care e-learning from Learning Pool & Ophira
 
عرض ملتقى النهائي جديد
عرض ملتقى النهائي جديدعرض ملتقى النهائي جديد
عرض ملتقى النهائي جديد
 
Donn DeBoard Customer Journey Maps: Visualizing an engaging customer experien...
Donn DeBoard Customer Journey Maps: Visualizing an engaging customer experien...Donn DeBoard Customer Journey Maps: Visualizing an engaging customer experien...
Donn DeBoard Customer Journey Maps: Visualizing an engaging customer experien...
 
Training in Tough Times
Training in Tough TimesTraining in Tough Times
Training in Tough Times
 
Workshop Summer Academy
Workshop Summer AcademyWorkshop Summer Academy
Workshop Summer Academy
 
Lezing abc
Lezing abcLezing abc
Lezing abc
 
Jane's walk 2012 evolution of ottawa
Jane's walk 2012   evolution of ottawaJane's walk 2012   evolution of ottawa
Jane's walk 2012 evolution of ottawa
 
Confsl 2010 Facebook Framework
Confsl 2010 Facebook FrameworkConfsl 2010 Facebook Framework
Confsl 2010 Facebook Framework
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
A History Of Salento Colombia
A History Of Salento ColombiaA History Of Salento Colombia
A History Of Salento Colombia
 
2markit
2markit2markit
2markit
 
Lcu14 wrap up meeting. Summary of Core Develoment teams achievements
Lcu14 wrap up meeting. Summary of Core Develoment teams achievementsLcu14 wrap up meeting. Summary of Core Develoment teams achievements
Lcu14 wrap up meeting. Summary of Core Develoment teams achievements
 

Similar to Lecture 23

Java programming Chapter 4.pptx
Java programming Chapter 4.pptxJava programming Chapter 4.pptx
Java programming Chapter 4.pptxssusera0d3d2
 
Java session08
Java session08Java session08
Java session08Niit Care
 
Java - File Input Output Concepts
Java - File Input Output ConceptsJava - File Input Output Concepts
Java - File Input Output ConceptsVicter Paul
 
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 NotesSakkaravarthiS1
 
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 & Outputphanleson
 
Unit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptxUnit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptxDrYogeshDeshmukh1
 
CSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdfCSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdfVithalReddy3
 
inputoutputstreams-140612032817-phpapp02.pdf
inputoutputstreams-140612032817-phpapp02.pdfinputoutputstreams-140612032817-phpapp02.pdf
inputoutputstreams-140612032817-phpapp02.pdfhemanth248901
 
Stream In Java.pptx
Stream In Java.pptxStream In Java.pptx
Stream In Java.pptxssuser9d7049
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptxcherryreddygannu
 
CHAPTER 5 mechanical engineeringasaaa.pptx
CHAPTER 5 mechanical engineeringasaaa.pptxCHAPTER 5 mechanical engineeringasaaa.pptx
CHAPTER 5 mechanical engineeringasaaa.pptxSadhilAggarwal
 
File Handling in Java.pdf
File Handling in Java.pdfFile Handling in Java.pdf
File Handling in Java.pdfSudhanshiBakre1
 
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
 
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
 

Similar to Lecture 23 (20)

Java programming Chapter 4.pptx
Java programming Chapter 4.pptxJava programming Chapter 4.pptx
Java programming Chapter 4.pptx
 
Java session08
Java session08Java session08
Java session08
 
Java - File Input Output Concepts
Java - File Input Output ConceptsJava - File Input Output Concepts
Java - File Input Output Concepts
 
Unit IV Notes.docx
Unit IV Notes.docxUnit IV Notes.docx
Unit IV Notes.docx
 
File Handling.pptx
File Handling.pptxFile Handling.pptx
File Handling.pptx
 
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
 
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
 
Unit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptxUnit No 5 Files and Database Connectivity.pptx
Unit No 5 Files and Database Connectivity.pptx
 
CSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdfCSE3146-ADV JAVA M2.pdf
CSE3146-ADV JAVA M2.pdf
 
JAVA
JAVAJAVA
JAVA
 
inputoutputstreams-140612032817-phpapp02.pdf
inputoutputstreams-140612032817-phpapp02.pdfinputoutputstreams-140612032817-phpapp02.pdf
inputoutputstreams-140612032817-phpapp02.pdf
 
Stream In Java.pptx
Stream In Java.pptxStream In Java.pptx
Stream In Java.pptx
 
IOStream.pptx
IOStream.pptxIOStream.pptx
IOStream.pptx
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptx
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
Java I/O
Java I/OJava I/O
Java I/O
 
CHAPTER 5 mechanical engineeringasaaa.pptx
CHAPTER 5 mechanical engineeringasaaa.pptxCHAPTER 5 mechanical engineeringasaaa.pptx
CHAPTER 5 mechanical engineeringasaaa.pptx
 
File Handling in Java.pdf
File Handling in Java.pdfFile Handling in Java.pdf
File Handling in Java.pdf
 
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?
 
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?
 

More from Debasish Pratihari (19)

Lecture 24
Lecture 24Lecture 24
Lecture 24
 
Lecture 22
Lecture 22Lecture 22
Lecture 22
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
 
Lecture 20
Lecture 20Lecture 20
Lecture 20
 
Lecture 19
Lecture 19Lecture 19
Lecture 19
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Lecture 17
Lecture 17Lecture 17
Lecture 17
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Lecture25
Lecture25Lecture25
Lecture25
 

Recently uploaded

Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

Recently uploaded (20)

Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

Lecture 23

  • 1. Core Java Debasish Pratihari Concept of Stream :   In file processing, input refers to the flow of data into a program and output means the flow of data out of the program. Java uses the concept of streams to represent the ordered sequence of data. A stream presents a uniform, easy-to-use, object-oriented interface between the program and the input/output devices. A stream in java is a path along which data flows. It has a source and a destination and it supports unidirectional movement of data. Note : Streams can be visualized as a sequence of data. Input/Output Operations Keyboard Screen Printer Mouse Memory Java Program Memory Disk Disk Network Network Streams in Java Note : Java streams are classified into two basic types  InputStream  OutputStream  InputStream extract (i.e reads) data from the source (file) and sends it to the program.  OutputStream takes data from the program and sends(i.e writes) it to the destination (file).  Lecture/core/io/23 1  Stream is often equipped with a buffer in memory.  A buffer is simply a block of memory that is used to batch up the data that is transferred to from an external device. feel the Technology…
  • 2. Core Java Debasish Pratihari Stream Classes The java.io package contains a large number of stream classes that provides capabilities for processing all types of data. These classes may be organized into two groups depending upon the data type they operate.  Byte Stream Classes  Character Stream Classes Byte Stream Classes Byte Stream Classes have been designed to provide functional features for creating and manipulating stream and files for reading and writing bytes. Since the streams are unidirectional, they can transmit bytes in only one direction and therefore java provides two kinds of byte stream classes : InputStream and OutputStream classes. InputStream Classes Input stream classes that are used to read 8-bit (I byte) include a super class know as InputStream and number of sub-classes for supporting various input-related functions. Program Architecture of File Copy Program ins Stream Input.txt read( ) inFile Program Output.txt outFile Lecture/core/io/23 write( ) outs Stream 2 feel the Technology…
  • 3. Core Java Debasish Pratihari Sample Program-1 Program Objective : To Copy Characters from one File to another. File Name : CopyChars.java import java.io.*; class CopyChars{ public static void main(String args[]){ File inFile = new File("Input.txt"); File outFile = new File("Output.txt"); FileReader ins= null; FileWriter outs=null; try{ ins= new FileReader(inFile); outs=new FileWriter(outFile); int ch; while((ch=ins.read())!= -1) outs.write(ch); }catch(IOException e){ System.out.println(e); System.exit(0); } finally{ try{ ins.close(); outs.close(); }catch(IOException e){ System.out.println(e); } } } } Lecture/core/io/23 3 feel the Technology…
  • 4. Core Java Debasish Pratihari Programming Architecture to Deal with Primitive Data type : Bytes are read from the file Bytes are converted to primitive types fis Primitive Types are read from dis dis prim.txt Program Screen primitive fos Bytes are written to the file dos Primitives are converted to a sequence of bytes Primitive Types are written to dos Sample Prohram-2 25% Program Objective : To deal with primitive Data types File Name : PrimitiveDemo.java import java.io.*; class PrimitiveDemo{ public static void main(String args[]) throws IOException{ File primitive = new File("prim.txt"); FileOutputStream fos = new FileOutputStream(primitive); DataOutputStream dos=new DataOutputStream(fos); dos.writeInt(1234); dos.writeDouble(34.45); dos.writeBoolean(false); dos.writeChar('a'); dos.close(); fos.close(); FileInputStream fis=new FileInputStream(primitive); DataInputStream dis=new DataInputStream(fis); System.out.println(dis.readInt()); System.out.println(dis.readDouble()); System.out.println(dis.readBoolean()); System.out.println(dis.readChar()); dis.close(); fis.close(); } } Lecture/core/io/23 4 feel the Technology…