@Override
    public <T> int readFieldNumber(Schema<T> schema) throws IOException
    {
        final int fieldNumber = input.readFieldNumber(schema);
        if (WireFormat.getTagWireType(input.getLastTag()) == WIRETYPE_REFERENCE)
        {
            // a reference.
            lastRef = input.readUInt32();
            messageReference = true;
        }
        else
        {
            // always unset.
            messageReference = false;
        }

        return fieldNumber;
    }
A ByteArrayInput w/c can handle cyclic dependencies when deserializing objects with graph transformations.

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