< prev index next >

src/java.base/share/classes/java/io/ByteArrayOutputStream.java

Print this page
@@ -157,20 +157,12 @@
       *
       * @param   out   the output stream to which to write the data.
       * @throws  NullPointerException if {@code out} is {@code null}.
       * @throws  IOException if an I/O error occurs.
       */
-     public void writeTo(OutputStream out) throws IOException {
-         if (Thread.currentThread().isVirtual()) {
-             byte[] bytes;
-             synchronized (this) {
-                 bytes = Arrays.copyOf(buf, count);
-             }
-             out.write(bytes);
-         } else synchronized (this) {
-             out.write(buf, 0, count);
-         }
+     public synchronized void writeTo(OutputStream out) throws IOException {
+         out.write(buf, 0, count);
      }
  
      /**
       * Resets the {@code count} field of this {@code ByteArrayOutputStream}
       * to zero, so that all currently accumulated output in the
< prev index next >