Void output filter, which silently swallows bytes written. Used with a 204 status (no content) or a HEAD request.
| 27 | * Void output filter, which silently swallows bytes written. Used with a 204 status (no content) or a HEAD request. |
| 28 | */ |
| 29 | public class VoidOutputFilter implements OutputFilter { |
| 30 | |
| 31 | /** |
| 32 | * Constructs a new VoidOutputFilter. |
| 33 | */ |
| 34 | public VoidOutputFilter() { |
| 35 | } |
| 36 | |
| 37 | private HttpOutputBuffer buffer = null; |
| 38 | |
| 39 | |
| 40 | // --------------------------------------------------- OutputBuffer Methods |
| 41 | |
| 42 | @Override |
| 43 | public int doWrite(ByteBuffer chunk) throws IOException { |
| 44 | return chunk.remaining(); |
| 45 | } |
| 46 | |
| 47 | |
| 48 | @Override |
| 49 | public long getBytesWritten() { |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | |
| 54 | // --------------------------------------------------- OutputFilter Methods |
| 55 | |
| 56 | @Override |
| 57 | public void setResponse(Response response) { |
| 58 | // NOOP: No need for parameters from response in this filter |
| 59 | } |
| 60 | |
| 61 | |
| 62 | @Override |
| 63 | public void setBuffer(HttpOutputBuffer buffer) { |
| 64 | this.buffer = buffer; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | @Override |
| 69 | public void flush() throws IOException { |
| 70 | this.buffer.flush(); |
| 71 | } |
| 72 | |
| 73 | |
| 74 | @Override |
| 75 | public void recycle() { |
| 76 | buffer = null; |
| 77 | } |
| 78 | |
| 79 | |
| 80 | @Override |
| 81 | public void end() throws IOException { |
| 82 | buffer.end(); |
| 83 | } |
| 84 | } |
nothing calls this directly
no outgoing calls
no test coverage detected