Thrift: Distinguish between string and binary types in C++ and Java.

Summary:
The upcoming TJSONProtocol handles string and binary types quite differently.
This change makes that distinction in all parts of the C++ binding.

Java already distinguished between string and binary, but this change
also updates the Java skip method to skip over strings as binary
so we don't get encoding errors when skipping binary data.

Reviewed By: mcslee

Test Plan: make check

Revert Plan: ok

Other Notes:
I just pulled this out of Chad Walters' JSON patch.
The only other change was adding readBinary (or was it writeBinary)
to TDenseProtocol.  Maybe inheriting from TBinaryProtocol wasn't a good idea.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665481 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/protocol/TDenseProtocol.cpp b/lib/cpp/src/protocol/TDenseProtocol.cpp
index 55f3902..dbb2d4a 100644
--- a/lib/cpp/src/protocol/TDenseProtocol.cpp
+++ b/lib/cpp/src/protocol/TDenseProtocol.cpp
@@ -439,6 +439,10 @@
   return subWriteString(str);
 }
 
+uint32_t TDenseProtocol::writeBinary(const std::string& str) {
+  return TDenseProtocol::writeString(str);
+}
+
 inline uint32_t TDenseProtocol::subWriteI32(const int32_t i32) {
   return vlqWrite(i32);
 }
@@ -718,6 +722,10 @@
   return subReadString(str);
 }
 
+uint32_t TDenseProtocol::readBinary(std::string& str) {
+  return TDenseProtocol::readString(str);
+}
+
 uint32_t TDenseProtocol::subReadI32(int32_t& i32) {
   uint64_t u64;
   uint32_t rv = vlqRead(u64);