Complete the proper handling of all special characters in JSON strings for TJSONProtocol

Reviewed By: dreiss

Test Plan: test/java/TestClient


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665373 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/java/src/TByteArrayOutputStream.java b/lib/java/src/TByteArrayOutputStream.java
new file mode 100644
index 0000000..94ce003
--- /dev/null
+++ b/lib/java/src/TByteArrayOutputStream.java
@@ -0,0 +1,29 @@
+// Copyright (c) 2006- Facebook
+// Distributed under the Thrift Software License
+//
+// See accompanying file LICENSE or visit the Thrift site at:
+// http://developers.facebook.com/thrift/
+
+package com.facebook.thrift;
+
+import java.io.ByteArrayOutputStream;
+
+/**
+ * Class that allows access to the underlying buf without doing deep
+ * copies on it.
+ *
+ * @author Mark Slee <mcslee@facebook.com>
+ */
+public class TByteArrayOutputStream extends ByteArrayOutputStream {
+  public TByteArrayOutputStream(int size) {
+    super(size);
+  }
+
+  public byte[] get() {
+    return buf;
+  }
+
+  public int len() {
+    return count;
+  }
+}