📜  使用 FileOutPutStream java 代码示例写入文件

📅  最后修改于: 2022-03-11 14:52:41.100000             🧑  作者: Mango

代码示例1
@Test
public void givenWritingStringToFile_whenUsingFileOutputStream_thenCorrect() 
  throws IOException {
    String str = "Hello";
    FileOutputStream outputStream = new FileOutputStream(fileName);
    byte[] strToBytes = str.getBytes();
    outputStream.write(strToBytes);

    outputStream.close();
}