CodesJava

Easy learning with example program codes

convert inputstream to bufferedreader java program

Example:

package com.codesjava;
 
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
 
public class InputStreamToBufferedReader {
  public static void main(String args[]){
      InputStream is = null;
      BufferedReader bfReader = null;
      try {
          is = new FileInputStream("D:/Test files/file 3.txt");
          bfReader = new BufferedReader(new InputStreamReader(is));
          String temp = null;
          while((temp = bfReader.readLine()) != null){
              System.out.println(temp);
          }
      } catch (Exception e) {
          e.printStackTrace();
      } 
  }
}

Output:

Content file 3

Download this example.

Please follow and like us:
error
Posted in IO   








Copyright © 2019 CodesJava DMCA.com Protection Status