class BodyFileRegion extends AbstractReferenceCounted implements FileRegion {

    private final RandomAccessBody body;
    private long transferred;

    BodyFileRegion(RandomAccessBody body) {
        this.body = requireNonNull(body, "body");
    }

    @Override
    public long position() {
        return 0;
    }

    @Override
    public long count() {
        return body.getContentLength();
    }

    @Override
    public long transfered() {
        return transferred();
    }

    @Override
    public long transferred() {
        return transferred;
    }

    @Override
    public FileRegion retain() {
        super.retain();
        return this;
    }

    @Override
    public FileRegion retain(int increment) {
        super.retain(increment);
        return this;
    }

    @Override
    public FileRegion touch() {
        return this;
    }

    @Override
    public FileRegion touch(Object hint) {
        return this;
    }

    @Override
    public long transferTo(WritableByteChannel target, long position) throws IOException {<FILL_FUNCTION_BODY>}

    @Override
    protected void deallocate() {
        closeSilently(body);
    }
}

        long written = body.transferTo(target);
        if (written > 0) {
            transferred += written;
        }
        return written;
    
<no_super_class>