public int written() {
        return buffer.writerIndex();
    }
Returns a number of bytes written of the underlying buffer so far.
resteasy/src/main/java/com/linecorp/armeria/internal/common/resteasy/ByteBufferBackedOutputStream.java