# Interface OutputBuffer

All Known Subinterfaces:
  `HttpOutputBuffer, OutputFilter`

All Known Implementing Classes:
  `AjpProcessor.SocketOutputBuffer, ChunkedOutputFilter, GzipOutputFilter, Http11OutputBuffer, Http11OutputBuffer.SocketOutputBuffer, Http2OutputBuffer, IdentityOutputFilter, VoidOutputFilter`

public interface OutputBuffer
Output buffer. This class is used internally by the protocol implementation. All writes from higher level code should happen via Response.doWrite().

## Method Summary

Modifier and Type
Method
Description
`int`
`doWrite(ByteBuffer chunk)`
Write the given data to the response.
`long`
`getBytesWritten()`
Bytes written to the underlying socket.

## Method Details

### doWrite

int doWrite(ByteBuffer chunk) throws IOException
Write the given data to the response. The caller owns the chunks.

Parameters:
  `chunk` - data to write
Returns:
  The number of bytes written which may be less than available in the input chunk
Throws:
  `IOException` - an underlying I/O error occurred

### getBytesWritten

long getBytesWritten()
Bytes written to the underlying socket. This includes the effects of chunking, compression, etc.

Returns:
  Bytes written for the current request