@Override
    protected <T> byte[] toByteArray(T message, Schema<T> schema)
    {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try
        {
            ProtostuffIOUtil.writeTo(out, message, schema, buf());
        }
        catch (IOException e)
        {
            throw new RuntimeException("Serializing to a byte array threw an IOException " +
                    "(should never happen).", e);
        }

        return out.toByteArray();
    }
Test the streaming output capability of {@link ProtostuffOutput}.

@author David Yu
@created Sep 19, 2010
protostuff-core/src/test/java/io/protostuff/ProtostuffStreamedOutputTest.java