Changed CollectorLoader to be a generic on the argument to toCanonicalOutput.

This lets us avoid the byte[] -> String -> byte[] shuffle otherwise required in ThriftLoader.
/cc @bamos only because this is quite a technically interesting change