Mercurial Hosting > luan
view src/goodjava/webserver/ResponseOutputStream.java @ 1521:d3e61cd2aca0
docs and shell bug fix
| author | Franklin Schmidt <fschmidt@gmail.com> | 
|---|---|
| date | Thu, 25 Jun 2020 23:17:14 -0600 | 
| parents | 27efb1fcbcb5 | 
| children | bba3e529e346 | 
line wrap: on
 line source
package goodjava.webserver; import java.io.ByteArrayOutputStream; import java.io.ByteArrayInputStream; import java.io.IOException; // plenty of room for improvement public class ResponseOutputStream extends ByteArrayOutputStream { private final Response response; public ResponseOutputStream(Response response) { if(response==null) throw new NullPointerException(); this.response = response; } @Override public void close() throws IOException { super.close(); int size = size(); response.body = new Response.Body( size, new ByteArrayInputStream(buf,0,size) ); } }
