@@ -0,0 +1,2477 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one%0A * or more contributor license agreements. See the NOTICE file%0A * distributed with this work for additional information%0A * regarding copyright ownership. The ASF licenses this file%0A * to you under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance%0A * with the License. You may obtain a copy of the License at%0A *%0A *   http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing,%0A * software distributed under the License is distributed on an%0A * %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A * KIND, either express or implied. See the License for the%0A * specific language governing permissions and limitations%0A * under the License.%0A */%0A%0Apackage com.facebook.thrift;%0A%0Aimport com.facebook.thrift.protocol.TProtocol;%0Aimport com.facebook.thrift.protocol.TProtocolFactory;%0Aimport com.facebook.thrift.transport.TIOStreamTransport;%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.UnsupportedEncodingException;%0A%0A/** Generic utility methods to create deserialization protocols. */%0Apublic class TDeserializeUtils %7B%0A  /**%0A   * Get a protocol for deserializing a Thrift object from a byte array.%0A   *%0A   * @param bytes The array to read from%0A   */%0A  public static TProtocol protocolFromByteArray(TProtocolFactory protocolFactory, byte%5B%5D bytes)%0A      throws TException %7B%0A    return protocolFactory.getProtocol(new TIOStreamTransport(new ByteArrayInputStream(bytes)));%0A  %7D%0A%0A  /**%0A   * Get a protocol for deserializing a Thrift object from a Java string, using a specified%0A   * character set for decoding.%0A   *%0A   * @param data The string to read from%0A   * @param charset Valid JVM charset%0A   */%0A  public static TProtocol protocolFromString(%0A      TProtocolFactory protocolFactory, String data, String charset) throws TException %7B%0A    try %7B%0A      return protocolFromByteArray(protocolFactory, data.getBytes(charset));%0A    %7D catch (UnsupportedEncodingException uex) %7B%0A      throw new TException(%22JVM DOES NOT SUPPORT ENCODING: %22 + charset);%0A    %7D%0A  %7D%0A%0A  /**%0A   * Get a protocol for deserializing a Thrift object from a Java string, using the default JVM%0A   * charset encoding.%0A   *%0A   * @param data The string to read from%0A   */%0A  public static TProtocol protocolFromString(TProtocolFactory protocolFactory, String data)%0A      throws TException %7B%0A    return protocolFromByteArray(protocolFactory, data.getBytes());%0A  %7D%0A%7D%0A

Add TDeserializeUtils utility class