SlideShare ist ein Scribd-Unternehmen logo
1 von 50
Stream-Based Input Output Supported By : java.io
Stream ,[object Object],[object Object],[object Object]
Input & Output Streams ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Binary & Character Streams ,[object Object],[object Object],[object Object],[object Object],[object Object]
InputStream & OutputStream java.lang.Object java.io.InputStream java.io.OutputStream java.io.Closeable java.io.Flushable
Closeable & Flushable ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basic Input Stream Operations ,[object Object],[object Object],[object Object],[object Object],[object Object]
InputStream ,[object Object]
FilterInputStream ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
FilterInputStream ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
FilterInputStream ,[object Object],[object Object],[object Object],[object Object]
OutputStream
Stream Readers
Stream Writers
Standard Streams ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
java.io.StreamTokenizer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using StreamTokenizer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using StreamTokenizer  contd. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Formatted output to Command-Line ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Formatted output to Command-Line  contd. ,[object Object],specifies the platform line separator so “%n” will have the same effect as “”. n specifies that the argument is a boolean value, so it will be output as “true” or “false”. B specifies that the argument is a string. S specifies that the argument value is a character and should be displayed as such. C apply to floating-point values and specify that the output representation should be decimal notation, scientific notation (with an exponent), or hexadecimal with an exponent, respectively. f, g, and a Apply to integers and specify the no. system to be used to output the integers. d, o, and x Meaning Conversion Character
Formatted output to Command-Line  contd. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Formatted output to Command-Line  contd. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Formatting Data into a String ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Formatting Data into a StringBuffer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Accessing Files & Directories
java.io.File ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Making the Path Portable Absolute & Relative Path ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Making the Path Portable UNC (Universal Naming Convention) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Accessing System Properties ,[object Object],[object Object]
Testing & Checking File Objects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Querying Files and Directories ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Getting File List ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
FileFilter & FilenameFilter ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],class MyFilter implements FileFilter { public boolean accept(File f) { if( f.getName().endsWith(".jpg")) return true; else return false; } }
Creating & Modifying Files & Folders ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Creating & Modifying Files & Folders ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Tracing Space of a Storage Device ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
FileInputStream ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
FileOutputStream ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
FileDescriptor ,[object Object],[object Object],[object Object],[object Object]
DataInputStream & DataOutputStream java.langObject java.io.InputStream java.io.FilterInputStream java.io.DataOutputStream java.io.DataInputStream java.io.DataInput java.io.OutputStream java.io.FilterOutputStream java.io.DataOutput
Using DataInputStream & DataOutputStream ,[object Object],[object Object],try{ FileOutputStream fos = new FileOutputStream("primitives.txt");   DataOutputStream dos = new DataOutputStream( fos ); dos.writeInt(50); dos.writeBoolean(true); dos.writeFloat(6.7f); dos.close(); FileInputStream fis = new FileInputStream("primitives.txt");   DataInputStream dis = new DataInputStream(fis ); System.out.println( dis.readInt() ); System.out.println( dis.readBoolean() ); System.out.println( dis.readFloat() ); dis.close(); } catch(IOException ioe) { ioe.printStackTrace(System.err); }
ObjectInputStream & ObjectOutputStream java.langObject java.io.InputStream java.io.OutputStream java.io.ObjectInputStream java.io.ObjectOutputStream java.io.ObjectStreamConstants java.io.ObjectInput java.io.ObjectOutput
Using ObjectInputStream & ObjectOutputStream ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],class MyClass  implements Serializable { int a; transient  float f; MyClass(int x, float y) { a = x; f = y; } void show() { System.out.println( a+" : "+f ); } }
ByteArrayInputStream
ByteArrayOutputStream
BufferedInputStream
BufferedOutputStream
PipedInputStream
PipedOutputStream
SequenceInputStream

Weitere ähnliche Inhalte

Was ist angesagt?

Java scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java ScannerJava scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java ScannerEdward Nyang'ali
 
PPT on Data Science Using Python
PPT on Data Science Using PythonPPT on Data Science Using Python
PPT on Data Science Using PythonNishantKumar1179
 
Python unit 2 M.sc cs
Python unit 2 M.sc csPython unit 2 M.sc cs
Python unit 2 M.sc csKALAISELVI P
 
Introduction To Programming with Python
Introduction To Programming with PythonIntroduction To Programming with Python
Introduction To Programming with PythonSushant Mane
 
Python language data types
Python language data typesPython language data types
Python language data typesHoang Nguyen
 
Basic data types in python
Basic data types in pythonBasic data types in python
Basic data types in pythonsunilchute1
 
Introduction to Python Language and Data Types
Introduction to Python Language and Data TypesIntroduction to Python Language and Data Types
Introduction to Python Language and Data TypesRavi Shankar
 
Python-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutabilityPython-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutabilityMohd Sajjad
 
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Pedro Rodrigues
 
Raspberry Pi - Lecture 5 Python for Raspberry Pi
Raspberry Pi - Lecture 5 Python for Raspberry PiRaspberry Pi - Lecture 5 Python for Raspberry Pi
Raspberry Pi - Lecture 5 Python for Raspberry PiMohamed Abdallah
 

Was ist angesagt? (19)

Java scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java ScannerJava scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java Scanner
 
PPT on Data Science Using Python
PPT on Data Science Using PythonPPT on Data Science Using Python
PPT on Data Science Using Python
 
Python unit 2 M.sc cs
Python unit 2 M.sc csPython unit 2 M.sc cs
Python unit 2 M.sc cs
 
Python for Beginners(v1)
Python for Beginners(v1)Python for Beginners(v1)
Python for Beginners(v1)
 
Introduction To Programming with Python
Introduction To Programming with PythonIntroduction To Programming with Python
Introduction To Programming with Python
 
Python for Beginners(v3)
Python for Beginners(v3)Python for Beginners(v3)
Python for Beginners(v3)
 
Python language data types
Python language data typesPython language data types
Python language data types
 
Python programming language
Python programming languagePython programming language
Python programming language
 
Basic data types in python
Basic data types in pythonBasic data types in python
Basic data types in python
 
Introduction to Python Language and Data Types
Introduction to Python Language and Data TypesIntroduction to Python Language and Data Types
Introduction to Python Language and Data Types
 
Python-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutabilityPython-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutability
 
Python Basics
Python BasicsPython Basics
Python Basics
 
Python ppt
Python pptPython ppt
Python ppt
 
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)
 
Python for Beginners(v2)
Python for Beginners(v2)Python for Beginners(v2)
Python for Beginners(v2)
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
 
Raspberry Pi - Lecture 5 Python for Raspberry Pi
Raspberry Pi - Lecture 5 Python for Raspberry PiRaspberry Pi - Lecture 5 Python for Raspberry Pi
Raspberry Pi - Lecture 5 Python for Raspberry Pi
 
LISP: Input And Output
LISP: Input And OutputLISP: Input And Output
LISP: Input And Output
 
Python : Data Types
Python : Data TypesPython : Data Types
Python : Data Types
 

Ähnlich wie Stream Based Input Output

Java Input and Output
Java Input and OutputJava Input and Output
Java Input and OutputDucat India
 
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
 
ppt on scanner class
ppt on scanner classppt on scanner class
ppt on scanner classdeepsxn
 
Class notes(week 5) on command line arguments
Class notes(week 5) on command line argumentsClass notes(week 5) on command line arguments
Class notes(week 5) on command line argumentsKuntal Bhowmick
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptxcherryreddygannu
 
Class notes(week 5) on command line arguments
Class notes(week 5) on command line argumentsClass notes(week 5) on command line arguments
Class notes(week 5) on command line argumentsKuntal Bhowmick
 
Stream In Java.pptx
Stream In Java.pptxStream In Java.pptx
Stream In Java.pptxssuser9d7049
 
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.pptxRathanMB
 
C programming(part 3)
C programming(part 3)C programming(part 3)
C programming(part 3)SURBHI SAROHA
 
Input and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequencesInput and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequencesssuserf86fba
 
THE IO LIBRARY in C++
THE IO LIBRARY in C++THE IO LIBRARY in C++
THE IO LIBRARY in C++Prof Ansari
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingRasan Samarasinghe
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in PythonMSB Academy
 

Ähnlich wie Stream Based Input Output (20)

Oodp mod4
Oodp mod4Oodp mod4
Oodp mod4
 
Java Input and Output
Java Input and OutputJava Input and Output
Java Input and Output
 
Java stream
Java streamJava stream
Java stream
 
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
 
ppt on scanner class
ppt on scanner classppt on scanner class
ppt on scanner class
 
I/O Streams
I/O StreamsI/O Streams
I/O Streams
 
Unit IV Notes.docx
Unit IV Notes.docxUnit IV Notes.docx
Unit IV Notes.docx
 
Class notes(week 5) on command line arguments
Class notes(week 5) on command line argumentsClass notes(week 5) on command line arguments
Class notes(week 5) on command line arguments
 
File Input and output.pptx
File Input  and output.pptxFile Input  and output.pptx
File Input and output.pptx
 
Class notes(week 5) on command line arguments
Class notes(week 5) on command line argumentsClass notes(week 5) on command line arguments
Class notes(week 5) on command line arguments
 
Stream In Java.pptx
Stream In Java.pptxStream In Java.pptx
Stream In Java.pptx
 
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
 
Stream
StreamStream
Stream
 
C programming(part 3)
C programming(part 3)C programming(part 3)
C programming(part 3)
 
Io Streams
Io StreamsIo Streams
Io Streams
 
Input and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequencesInput and output basic of c++ programming and escape sequences
Input and output basic of c++ programming and escape sequences
 
THE IO LIBRARY in C++
THE IO LIBRARY in C++THE IO LIBRARY in C++
THE IO LIBRARY in C++
 
Lecture 8- Data Input and Output
Lecture 8- Data Input and OutputLecture 8- Data Input and Output
Lecture 8- Data Input and Output
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
Input processing and output in Python
Input processing and output in PythonInput processing and output in Python
Input processing and output in Python
 

Mehr von Bharat17485

Channel Based Io
Channel Based IoChannel Based Io
Channel Based IoBharat17485
 
Developing Multithreaded Applications
Developing Multithreaded ApplicationsDeveloping Multithreaded Applications
Developing Multithreaded ApplicationsBharat17485
 
Interfaces & Abstract Classes
Interfaces & Abstract ClassesInterfaces & Abstract Classes
Interfaces & Abstract ClassesBharat17485
 
Exceptions & Its Handling
Exceptions & Its HandlingExceptions & Its Handling
Exceptions & Its HandlingBharat17485
 
Primitive Wrappers
Primitive WrappersPrimitive Wrappers
Primitive WrappersBharat17485
 
Regular Expression
Regular ExpressionRegular Expression
Regular ExpressionBharat17485
 
Applying Generics
Applying GenericsApplying Generics
Applying GenericsBharat17485
 

Mehr von Bharat17485 (12)

Channel Based Io
Channel Based IoChannel Based Io
Channel Based Io
 
Core Java
Core JavaCore Java
Core Java
 
Developing Multithreaded Applications
Developing Multithreaded ApplicationsDeveloping Multithreaded Applications
Developing Multithreaded Applications
 
Interfaces & Abstract Classes
Interfaces & Abstract ClassesInterfaces & Abstract Classes
Interfaces & Abstract Classes
 
Enum
EnumEnum
Enum
 
Exceptions & Its Handling
Exceptions & Its HandlingExceptions & Its Handling
Exceptions & Its Handling
 
Jstl & El
Jstl & ElJstl & El
Jstl & El
 
Primitive Wrappers
Primitive WrappersPrimitive Wrappers
Primitive Wrappers
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
String Handling
String HandlingString Handling
String Handling
 
Swing
SwingSwing
Swing
 
Applying Generics
Applying GenericsApplying Generics
Applying Generics
 

Stream Based Input Output