0% found this document useful (0 votes)
55 views17 pages

Java I/O Stream

An I/O stream represents an input source or output destination for data. There are different types of streams for bytes versus characters and for input versus output. The java.io package defines abstract classes like InputStream and OutputStream that are extended by concrete stream classes. Input streams read data from a source one item at a time while output streams write data to a destination one item at a time.

Uploaded by

Rushika Naragani
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views17 pages

Java I/O Stream

An I/O stream represents an input source or output destination for data. There are different types of streams for bytes versus characters and for input versus output. The java.io package defines abstract classes like InputStream and OutputStream that are extended by concrete stream classes. Input streams read data from a source one item at a time while output streams write data to a destination one item at a time.

Uploaded by

Rushika Naragani
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Java I/O Stream

Topics
1 2

3
4 5 6 7

8
9 10 11

What is an I/O stream? Types of Streams Java.io package hierarchy Control flow of an I/O operation using Streams Byte streams Character streams Buffered streams Standard I/O streams Data streams Object streams File class
2

1.What is an I/O Stream?


3

I/O Streams

An I/O Stream represents an input source or an output destination


A stream can represent many different kinds of sources and destinations disk files, devices, other programs, a network socket, and memory arrays Streams support many different kinds of data simple bytes, primitive data types, localized characters, and objects Some streams simply pass on data; others manipulate and transform the data in useful ways.
4

Input Stream

A program uses an input stream to read data from a source, one item at a time

6
source:java.sun.com

Output Stream

A program uses an output stream to write data to a destination, one item at time

2.Types of Streams
8

General Stream Types


Character and Byte Streams Character vs. Byte Input and Output Streams Based on source or destination Node and Filter Streams Whether the data on a stream is manipulated or transformed or not

3.java.io package Hierarchy


13

Abstract Classes

InputStream & OutputStream


Reader & Writer

15

InputStream
This abstract class is the superclass of all classes representing an input stream of bytes.
Syntax: public abstract class InputStream extends Object implements Closeable

Methods of InputStream Class


abstract int read() int read(byte[] b) int read(byte[] b, int off, int len) int available() void close() long skip(long n) boolean markSupported() void mark(int readlimit) void reset()

Streams
InputStream

OutputStream

Reader

Writer

14

You might also like