Java BufferedReader create from InputStream using platform default encoding
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; public class Main { public static void main(String[] args) throws Exception { InputStream is = new FileInputStream("Main.java"); Reader r = new InputStreamReader(is); BufferedReader reader = new BufferedReader(r); StringBuilder sb = new StringBuilder(); String lines = reader.readLine(); while (lines != null) { sb.append(lines.toUpperCase() + "\n"); lines = reader.readLine();/*w w w . j a v a 2 s .c o m*/ } reader.close(); } }