There is the following piece of code:
OutputStream outputStream = null; try { outputStream = new BufferedOutputStream(new FileOutputStream(fileName)); } catch (FileNotFoundException e) { e.printStackTrace(); } try { assert outputStream != null; assert text != null; outputStream.write(text.getBytes()); } catch (IOException e) { e.printStackTrace(); } The problem is that after the execution, the contents of the file are deleted, and text.getBytes() is output to the console.
How can I fix it?