Mercurial Hosting > luan
view src/luan/webserver/ResponseOutputStream.java @ 1160:4beabb087be6
add http/impl
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 05 Feb 2018 22:33:59 -0700 |
parents | c123ee15f99b |
children |
line wrap: on
line source
package luan.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) ); } }