org.apache.thrift.protocol
Class TProtocolUtil

java.lang.Object
  extended by org.apache.thrift.protocol.TProtocolUtil

public class TProtocolUtil
extends java.lang.Object

Utility class with static methods for interacting with protocol data streams.


Constructor Summary
TProtocolUtil()
           
 
Method Summary
static void setMaxSkipDepth(int depth)
          Specifies the maximum recursive depth that the skip function will traverse before throwing a TException.
static void skip(TProtocol prot, byte type)
          Skips over the next data element from the provided input TProtocol object.
static void skip(TProtocol prot, byte type, int maxDepth)
          Skips over the next data element from the provided input TProtocol object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TProtocolUtil

public TProtocolUtil()
Method Detail

setMaxSkipDepth

public static void setMaxSkipDepth(int depth)
Specifies the maximum recursive depth that the skip function will traverse before throwing a TException. This is a global setting, so any call to skip in this JVM will enforce this value.

Parameters:
depth - the maximum recursive depth. A value of 2 would allow the skip function to skip a structure or collection with basic children, but it would not permit skipping a struct that had a field containing a child struct. A value of 1 would only allow skipping of simple types and empty structs/collections.

skip

public static void skip(TProtocol prot,
                        byte type)
                 throws TException
Skips over the next data element from the provided input TProtocol object.

Parameters:
prot - the protocol object to read from
type - the next value will be intepreted as this TType value.
Throws:
TException

skip

public static void skip(TProtocol prot,
                        byte type,
                        int maxDepth)
                 throws TException
Skips over the next data element from the provided input TProtocol object.

Parameters:
prot - the protocol object to read from
type - the next value will be intepreted as this TType value.
maxDepth - this function will only skip complex objects to this recursive depth, to prevent Java stack overflow.
Throws:
TException