Java tutorial
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; public class Main { public static void main(String[] args) throws Exception { FileInputStream is = new FileInputStream("c:/test.txt"); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedOutputStream bos = new BufferedOutputStream(baos); int value; while ((value = bis.read()) != -1) { bos.write(value); } bos.flush(); for (byte b : baos.toByteArray()) { char c = (char) b; System.out.println(c); } } }