@Override
    public <T> void writeObject(int fieldNumber, T value, Schema<T> schema,
            boolean repeated) throws IOException
    {
        final ProtostuffOutput output = this.output;

        if (references.shouldIncrement(refCount, value, output, fieldNumber))
        {
            refCount++;

            output.tail = output.sink.writeVarInt32(
                    makeTag(fieldNumber, WIRETYPE_START_GROUP),
                    output,
                    output.tail);

            schema.writeTo(this, value);

            output.tail = output.sink.writeVarInt32(
                    makeTag(fieldNumber, WIRETYPE_END_GROUP),
                    output,
                    output.tail);
        }
    }
A ProtostuffOutput w/c can handle cyclic dependencies when serializing objects with graph transformations.

@author David Yu
@created Dec 10, 2010
protostuff-core/src/main/java/io/protostuff/GraphProtostuffOutput.java