Add writeAsHex(raw_ostream &) method to BinaryRef.

This hides the implementation. A future commit will remove the
error-prone getHex() and getBinary() methods.