为什么 OutputStream write 方法打印在 PrintWriter 的 println 方法之前?

Why is OutputStream write method printed before PrintWriter's println method?

我正在使用 OutputStreamPrintWriter。这是我的代码:

  OutputStream os = System.out;
  PrintWriter writer = new PrintWriter(os, false);

  writer.println("Hell");
  writer.println("Hello");
  writer.println("Hello");
  writer.println("Hello");
  writer.println("Hello");
  writer.println();
  os.write("45\n".getBytes(), 0, "45\n".getBytes().length);
  writer.println();
  writer.flush();
  os.flush();

输出为:

45
Hello
Hello
Hello
Hello
Hello

为什么 45Hello 之前打印,即使 PrintWriterOutputStream 之前被刷新?

编辑:如果冲洗有误请指正。

好吧,很明显,当调用 os.write() 时,您会到达 PrintStream.write():

默认为 autoFlush = true,而 PrintWriter 初始化为 autoFlush=false