Skip buffer in StreamUtils#copy(String)

This commit is contained in:
“7fantasy7” 2023-11-18 21:55:10 +03:00 committed by Juergen Hoeller
parent e24954068a
commit 54f87f1ff7
1 changed files with 2 additions and 5 deletions

View File

@ -23,8 +23,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
@ -133,9 +131,8 @@ public abstract class StreamUtils {
Assert.notNull(charset, "No Charset specified"); Assert.notNull(charset, "No Charset specified");
Assert.notNull(out, "No OutputStream specified"); Assert.notNull(out, "No OutputStream specified");
Writer writer = new OutputStreamWriter(out, charset); out.write(in.getBytes(charset));
writer.write(in); out.flush();
writer.flush();
} }
/** /**