There is such a code.
File f = new File("aa.txt"); File f1 = new File("bb.txt"); OutputStream out = new FileOutputStream(f1); int a; BufferedReader br = new BufferedReader(new FileReader(f)); String str; ArrayList<String> arr = new ArrayList<String>(); while((str=br.readLine())!=null){ arr.add(str); } str=""; for(String s : arr){ str+=s+"\n"; } System.out.println(str); byte[] b = str.getBytes(); out.write(b); out.close(); The contents of the file "aa" - a few lines. Accordingly, I would like to transfer the text (preformatted it) to the file "bb". The main question is how to write information with line breaks to a file. I tried to create a string with control characters, but apparently they do not read the stream.
"\n"are written and do not squeak. - PinkTux\nit is better to useEnvironment.NewLine- Bulson