@@ -0,0 +1,2477 @@
+// Copyright (c) 2006- Facebook%0A// Distributed under the Thrift Software License%0A//%0A// See accompanying file LICENSE or visit the Thrift site at:%0A// http://developers.facebook.com/thrift/%0A%0Apackage com.facebook.thrift;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.UnsupportedEncodingException;%0A%0Aimport com.facebook.thrift.protocol.TBinaryProtocol;%0Aimport com.facebook.thrift.protocol.TProtocol;%0Aimport com.facebook.thrift.protocol.TProtocolFactory;%0Aimport com.facebook.thrift.transport.TIOStreamTransport;%0Aimport com.facebook.thrift.transport.TTransport;%0A%0A/**%0A * Generic utility for easily deserializing objects from a byte array or Java%0A * String.%0A *%0A * @author David Reiss %3Cdreiss@facebook.com%3E%0A */%0Apublic class TDeserializer %7B%0A  private final TProtocolFactory protocolFactory_;%0A%0A  /**%0A   * Create a new TDeserializer that uses the TBinaryProtocol by default.%0A   */%0A  public TDeserializer() %7B%0A    this(new TBinaryProtocol.Factory());%0A  %7D%0A%0A  /**%0A   * Create a new TDeserializer. It will use the TProtocol specified by the%0A   * factory that is passed in.%0A   *%0A   * @param protocolFactory Factory to create a protocol%0A   */%0A  public TDeserializer(TProtocolFactory protocolFactory) %7B%0A    protocolFactory_ = protocolFactory;%0A  %7D%0A%0A  /**%0A   * Deserialize the Thrift object from a byte array.%0A   *%0A   * @param base The object to read into%0A   * @param bytes The array to read from%0A   */%0A  public void deserialize(TBase base, byte%5B%5D bytes) throws TException %7B%0A    base.read(%0A        protocolFactory_.getProtocol(%0A          new TIOStreamTransport(%0A            new ByteArrayInputStream(bytes))));%0A  %7D%0A%0A  /**%0A   * Deserialize the Thrift object from a Java string, using a specified%0A   * character set for decoding.%0A   *%0A   * @param base The object to read into%0A   * @param data The string to read from%0A   * @param charset Valid JVM charset%0A   */%0A  public void deserialize(TBase base, String data, String charset) throws TException %7B%0A    try %7B%0A      deserialize(base, 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   * Deerialize the Thrift object from a Java string, using the default JVM%0A   * charset encoding.%0A   *%0A   * @param base The object to read into%0A   * @param data The string to read from%0A   * @return Serialized object as a String%0A   */%0A  public void toString(TBase base, String data) throws TException %7B%0A    deserialize(base, data.getBytes());%0A  %7D%0A%7D%0A%0A

Add a TDeserializer for Java.