Package org.apache.thrift.protocol

Examples of org.apache.thrift.protocol.TCompactProtocol$Factory


    sock.open();
    try {
      TProtocol prot;
      if (specifyCompact) {
        prot = new TCompactProtocol(transport);
      } else {
        prot = new TBinaryProtocol(transport);
      }
      Hbase.Client client = new Hbase.Client(prot);
      if (!tableCreated){
View Full Code Here


        ThriftCatalog writeCatalog = writeCodecManager.getCatalog();
        ThriftStructMetadata<T> writeMetadata = writeCatalog.getThriftStructMetadata(structClass);
        assertNotNull(writeMetadata);

        TMemoryBuffer transport = new TMemoryBuffer(10 * 1024);
        TCompactProtocol protocol = new TCompactProtocol(transport);
        writeCodec.write(structInstance, protocol);

        T copy = readCodec.read(protocol);
        assertNotNull(copy);
        assertEquals(copy, structInstance);
View Full Code Here

    private <T> void testRoundTripSerialize(T value)
            throws Exception
    {
        // write value
        TMemoryBuffer transport = new TMemoryBuffer(10 * 1024);
        TCompactProtocol protocol = new TCompactProtocol(transport);
        codecManager.write((Class<T>) value.getClass(), value, protocol);

        // read value back
        T copy = codecManager.read((Class<T>) value.getClass(), protocol);
        assertNotNull(copy);
View Full Code Here

    private <T> void testRoundTripSerialize(ThriftType type, T value)
            throws Exception
    {
        // write value
        TMemoryBuffer transport = new TMemoryBuffer(10 * 1024);
        TCompactProtocol protocol = new TCompactProtocol(transport);
        codecManager.write(type, value, protocol);

        // read value back
        T copy = (T) codecManager.read(type, protocol);
        assertNotNull(copy);
View Full Code Here

    private final int hashCode;

    public ClientWrapper() throws Exception{
      transport = new TFastFramedTransport(new TSocket(hostname, port));
      transport.open();
      client = new ThriftSourceProtocol.Client(new TCompactProtocol
        (transport));
      // Not a great hash code, but since this class is immutable and there
      // is at most one instance of the components of this class,
      // this works fine [If the objects are equal, hash code is the same]
      hashCode = random.nextInt();
View Full Code Here

    sock.open();
    try {
      TProtocol prot;
      if (specifyCompact) {
        prot = new TCompactProtocol(transport);
      } else {
        prot = new TBinaryProtocol(transport);
      }
      Hbase.Client client = new Hbase.Client(prot);
      if (!tableCreated){
View Full Code Here

    sock.open();
    try {
      TProtocol prot;
      if (specifyCompact) {
        prot = new TCompactProtocol(transport);
      } else {
        prot = new TBinaryProtocol(transport);
      }
      Hbase.Client client = new Hbase.Client(prot);
      if (!tableCreated){
View Full Code Here

        ChannelBuffer frame = null;
        while (null != (frame = (ChannelBuffer) super.decode(ctx, channel,
                                                             buffer))) {
            if (ms == null) ms = new ArrayList<SyncMessage>();
            ChannelBufferInputStream is = new ChannelBufferInputStream(frame);
            TCompactProtocol thriftProtocol =
                    new TCompactProtocol(new TIOStreamTransport(is));
            SyncMessage bsm = new SyncMessage();
            bsm.read(thriftProtocol);
            ms.add(bsm);
        }
        return ms;
View Full Code Here

    protected Object encode(ChannelHandlerContext ctx, Channel channel,
                            Object message) throws Exception {
        if (message instanceof SyncMessage) {
            ChannelBuffer buf = new DynamicChannelBuffer(512);
            ChannelBufferOutputStream os = new ChannelBufferOutputStream(buf);
            TCompactProtocol thriftProtocol =
                    new TCompactProtocol(new TIOStreamTransport(os));
            ((SyncMessage) message).write(thriftProtocol);

            ChannelBuffer len = ChannelBuffers.buffer(4);
            len.writeInt(buf.readableBytes());
            return ChannelBuffers.wrappedBuffer(len, buf);
View Full Code Here

    sock.open();
    try {
      TProtocol prot;
      if (specifyCompact) {
        prot = new TCompactProtocol(transport);
      } else {
        prot = new TBinaryProtocol(transport);
      }
      Hbase.Client client = new Hbase.Client(prot);
      if (!tableCreated){
View Full Code Here

TOP

Related Classes of org.apache.thrift.protocol.TCompactProtocol$Factory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.