Add explicit binary type to Thrift
Summary: Identical to string in all languages except Java. Java String is NOT binary-safe, so we need to use raw byte[] in that case. PHP/RUBY/Python strings are all binary safe, and C++ std::string works fine and manages memory for you so it's the safest route. Java just needs this tweak.
Reviewed By: aditya
Test Plan: Use "binary" as a type instead of String.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665099 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/java/src/protocol/TProtocol.java b/lib/java/src/protocol/TProtocol.java
index 23829cf..08a7ef3 100644
--- a/lib/java/src/protocol/TProtocol.java
+++ b/lib/java/src/protocol/TProtocol.java
@@ -84,6 +84,8 @@
public abstract void writeString(String str) throws TException;
+ public abstract void writeBinary(byte[] bin) throws TException;
+
/**
* Reading methods.
*/
@@ -126,4 +128,6 @@
public abstract String readString() throws TException;
+ public abstract byte[] readBinary() throws TException;
+
}