Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
JAVA IO Streams
Stream <ul><li>Stream is a flow of data signals  </li></ul><ul><ul><li>From a program to a program or </li></ul></ul><ul><...
Package java.io <ul><li>This package offers the below classes that handle the streams </li></ul>java.lang.Object InputStre...
Public abstract class java.io.InputStream <ul><li>This class abstract method to be used to read the stream in binary forma...
Public abstract class java.io.OutputStream <ul><li>This class abstract method to be used to write into the stream in binar...
public abstract class java.io.Reader and public abstract class java.io.Writer <ul><li>This Reader class abstracts methods ...
public class InputStreamReader <ul><li>This class provides methods for reading from a input stream in character format </l...
public class java.io.BufferedReader <ul><li>This provides methods to read from the input stream in character format and is...
public class java.io.File <ul><li>This provides class to represent files and handle their attributes and other manipulatio...
Public Methods of File Class <ul><li>long length() </li></ul><ul><li>long lastModified() </li></ul><ul><li>boolean canRead...
public class java.io.FileInputStream() <ul><li>This class is used to read from a file in binary format </li></ul><ul><li>C...
public class java.io.FileOutputStream() <ul><li>This class is used to write into a file in binary format </li></ul><ul><li...
Upcoming SlideShare
Loading in …5
×

Iostreams

1,602 views

Published on

iostreams explanations

Published in: Education
  • Be the first to comment

  • Be the first to like this

Iostreams

  1. 1. JAVA IO Streams
  2. 2. Stream <ul><li>Stream is a flow of data signals </li></ul><ul><ul><li>From a program to a program or </li></ul></ul><ul><ul><li>From a device to a program or </li></ul></ul><ul><ul><li>From a program to a device or </li></ul></ul><ul><ul><li>From a device to a device </li></ul></ul>Output Stream Input Stream Input Stream Output Stream
  3. 3. Package java.io <ul><li>This package offers the below classes that handle the streams </li></ul>java.lang.Object InputStream FileInputStream Output Stream Reader Writer IOException File FileOutputStream InputStreamReader BufferedReader PrintWriter
  4. 4. Public abstract class java.io.InputStream <ul><li>This class abstract method to be used to read the stream in binary format only </li></ul><ul><li>System.in Object offers a reference for this class responsible for handling standard input stream </li></ul>
  5. 5. Public abstract class java.io.OutputStream <ul><li>This class abstract method to be used to write into the stream in binary format only </li></ul><ul><li>System.out Object offers a reference for this class responsible for handling standard output stream </li></ul>
  6. 6. public abstract class java.io.Reader and public abstract class java.io.Writer <ul><li>This Reader class abstracts methods used to read from a stream in character format </li></ul><ul><li>This Writer class abstracts methods used to write from a stream in character format </li></ul>
  7. 7. public class InputStreamReader <ul><li>This class provides methods for reading from a input stream in character format </li></ul><ul><li>Constructor </li></ul><ul><ul><li>publlic InputStreamReader(InputStream); </li></ul></ul><ul><li>This is not associated with a buffer and hence not suggested class to handle the input streams </li></ul>
  8. 8. public class java.io.BufferedReader <ul><li>This provides methods to read from the input stream in character format and is associated with buffer. </li></ul><ul><li>Constructor </li></ul><ul><ul><li>public BufferedReader(InputStreamReader); </li></ul></ul><ul><li>Methods </li></ul><ul><ul><li>public int read(); </li></ul></ul><ul><ul><li>Public void skip(long); </li></ul></ul><ul><ul><li>Public String readLine(); </li></ul></ul>
  9. 9. public class java.io.File <ul><li>This provides class to represent files and handle their attributes and other manipulations like deleting, creating or listing the contents of a folder ..etc,. </li></ul><ul><li>Constructors </li></ul><ul><ul><li>public File(String filePath); </li></ul></ul>
  10. 10. Public Methods of File Class <ul><li>long length() </li></ul><ul><li>long lastModified() </li></ul><ul><li>boolean canRead() </li></ul><ul><li>boolean canWrite() </li></ul><ul><li>boolean createNewFile() </li></ul><ul><li>boolean delete() </li></ul><ul><li>boolean exists() </li></ul><ul><li>boolean isDirectory() </li></ul><ul><li>boolean isFile() </li></ul><ul><li>String getName() </li></ul><ul><li>String getPath() </li></ul><ul><li>String[] list() </li></ul><ul><li>File listFiles() </li></ul><ul><li>Static File[] listRoots() </li></ul>
  11. 11. public class java.io.FileInputStream() <ul><li>This class is used to read from a file in binary format </li></ul><ul><li>Construtors </li></ul><ul><ul><li>public FileInputStream(File) </li></ul></ul><ul><ul><li>public FileInputStream(String) </li></ul></ul><ul><li>Public Methods </li></ul><ul><ul><li>int read(byte[]) </li></ul></ul><ul><ul><li>void close() </li></ul></ul><ul><ul><li>long available() </li></ul></ul>
  12. 12. public class java.io.FileOutputStream() <ul><li>This class is used to write into a file in binary format </li></ul><ul><li>Construtors </li></ul><ul><ul><li>public FileOutputStream(File) </li></ul></ul><ul><ul><li>public FileOutputStream(String) </li></ul></ul><ul><ul><li>public FileOutputStream(File,boolean) </li></ul></ul><ul><ul><li>public FileOutputStream(String,boolean) </li></ul></ul><ul><li>Public Methods </li></ul><ul><ul><li>void write(byte[]) </li></ul></ul><ul><ul><li>void close() </li></ul></ul>

×