new BufferedWriter(new OutputStreamWriter(System.out)) : BufferedWriter « File Input Output « Java






new BufferedWriter(new OutputStreamWriter(System.out))

 

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String strLine = in.readLine();
    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
    out.write(strLine, 0, strLine.length());
    out.flush();
    in.close();
    out.close();
  }
}

   
  








Related examples in the same category

1.Read Input From User and Write to File
2.Write to file using a BufferedWriter
3.Use a BufferedReader and a BufferedWriter to copy a text file, inverting the case of letters in the process
4.Writing to a File: If the file does not exist, it is automatically created.
5.Appending to a File
6.Write text file
7.Nested creation of FileWriter, BufferedWriter and PrintWriter
8.Create BufferedWriter from FileWriter and write strings to the file