Skip to content

Commit

Permalink
Skip buffer in StreamUtils#copy(String)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny-Botyanovsky authored and jhoeller committed Nov 20, 2023
1 parent e249540 commit 54f87f1
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset;

import org.springframework.lang.Nullable;
Expand Down Expand Up @@ -133,9 +131,8 @@ public static void copy(String in, Charset charset, OutputStream out) throws IOE
Assert.notNull(charset, "No Charset specified");
Assert.notNull(out, "No OutputStream specified");

Writer writer = new OutputStreamWriter(out, charset);
writer.write(in);
writer.flush();
out.write(in.getBytes(charset));
out.flush();
}

/**
Expand Down

0 comments on commit 54f87f1

Please sign in to comment.