public class ChunkOutputStream extends OutputStream
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);
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
void |
reset() |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
write
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void reset()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
Copyright © 2021 JBoss by Red Hat. All rights reserved.