@Override
    public void writeByteRange(boolean utf8String, int fieldNumber, byte[] value,
            int offset, int length, boolean repeated) throws IOException
    {
        final WriteSink sink = this.sink;
        if (utf8String)
        {
            if (lastNumber == fieldNumber)
            {
                // repeated
                tail = sink.writeByteArray(
                        value, offset, length,
                        this,
                        sink.writeByteArray(
                                DASH_AND_SPACE,
                                this,
                                newLine(
                                        inc(indent, 2),
                                        sink,
                                        this,
                                        tail)));

                return;
            }

            tail = sink.writeByteArray(
                    value, offset, length,
                    this,
                    writeKey(
                            schema.getFieldName(fieldNumber),
                            indent,
                            repeated,
                            sink,
                            this,
                            tail));

            lastNumber = fieldNumber;
            return;
        }

        if (lastNumber == fieldNumber)
        {
            // repeated
            tail = sink.writeByteArrayB64(
                    value, offset, length,
                    this,
                    sink.writeByteArray(
                            DASH_AND_SPACE,
                            this,
                            newLine(
                                    inc(indent, 2),
                                    sink,
                                    this,
                                    tail)));

            return;
        }

        tail = sink.writeByteArrayB64(
                value, offset, length,
                this,
                writeKey(
                        schema.getFieldName(fieldNumber),
                        indent,
                        repeated,
                        sink,
                        this,
                        tail));

        lastNumber = fieldNumber;
    }
Before serializing a message/object tied to a schema, this should be called.
protostuff-yaml/src/main/java/io/protostuff/YamlOutput.java