Skip to content
Permalink
Browse files
StringBody: just write the bytes to the output stream
  • Loading branch information
John Gallagher authored and ok2c committed Mar 16, 2022
1 parent 6a487ba commit 5f9bc347ee6a2191b2ad10eb2e0ed4c19d35f83d
Showing 1 changed file with 1 addition and 8 deletions.
@@ -29,7 +29,6 @@

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
@@ -70,13 +69,7 @@ public Reader getReader() {
@Override
public void writeTo(final OutputStream out) throws IOException {
Args.notNull(out, "Output stream");
final InputStream in = new ByteArrayInputStream(this.content);
final byte[] tmp = new byte[4096];
int l;
while ((l = in.read(tmp)) != -1) {
out.write(tmp, 0, l);
}
out.flush();
out.write(this.content);
}

@Override

0 comments on commit 5f9bc34

Please sign in to comment.