Class ChunkOutputStream

java.lang.Object
java.io.OutputStream
org.jboss.resteasy.spi.AsyncOutputStream
org.jboss.resteasy.plugins.server.vertx.ChunkOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class ChunkOutputStream extends AsyncOutputStream
Class to help application that are built to write to an OutputStream to chunk the content
 
 DefaultHttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
 HttpHeaders.setTransferEncodingChunked(response);
 response.headers().set(CONTENT_TYPE, "application/octet-stream");
 //other headers
 ctx.write(response);
 // code of the application that use the ChunkOutputStream
 // Don't forget to close the ChunkOutputStream after use!
 ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT).addListener(ChannelFutureListener.CLOSE);
 
 
Author:
tbussier