Package com.facebook.thrift.protocol

Examples of com.facebook.thrift.protocol.TProtocol


 
  private void run() throws IOError, TException, NotFound, IllegalArgument,
      AlreadyExists {
   
    TTransport transport = new TSocket("localhost", port);
    TProtocol protocol = new TBinaryProtocol(transport, true, true);
    Hbase.Client client = new Hbase.Client(protocol);

    transport.open();

    byte[] t = bytes("demo_table");
View Full Code Here


 
  private synchronized void open()
  {
    LOG.info("Opening Thrift connection to " + host + ":" + port);
    transport = new TSocket(host, port);
      TProtocol protocol = new TBinaryProtocol(transport);
      client = new XTraceReporter.Client(protocol);
      shouldRetry = true;
     
      while (shouldRetry) {
        try {
View Full Code Here

          htrans.setZlibBufferSize(10);
          transport = htrans;
        }
      }

      TProtocol prot;
      if (header) {
        prot = new TCompactProtocol(transport);
      } else {
        prot = new TBinaryProtocol(transport);
      }
View Full Code Here

    testServerRequest();
  }

  public static void testNakedByte() throws Exception {
    TMemoryBuffer buf = new TMemoryBuffer(0);
    TProtocol proto = factory.getProtocol(buf);
    proto.writeByte((byte)123);
    byte out = proto.readByte();
    if (out != 123) {
      throw new RuntimeException("Byte was supposed to be " + (byte)123 + " but was " + out);
    }
  }
View Full Code Here

    });
  }

  public static void testNakedI16(short n) throws Exception {
    TMemoryBuffer buf = new TMemoryBuffer(0);
    TProtocol proto = factory.getProtocol(buf);
    proto.writeI16(n);
    // System.out.println(buf.inspect());
    int out = proto.readI16();
    if (out != n) {
      throw new RuntimeException("I16 was supposed to be " + n + " but was " + out);
    }
  }
View Full Code Here

    });
  }

  public static void testNakedI32(int n) throws Exception {
    TMemoryBuffer buf = new TMemoryBuffer(0);
    TProtocol proto = factory.getProtocol(buf);
    proto.writeI32(n);
    // System.out.println(buf.inspect());
    int out = proto.readI32();
    if (out != n) {
      throw new RuntimeException("I32 was supposed to be " + n + " but was " + out);
    }
  }
View Full Code Here

  }

  public static void testNakedI64(long n) throws Exception {
    TMemoryBuffer buf = new TMemoryBuffer(0);
    TProtocol proto = factory.getProtocol(buf);
    proto.writeI64(n);
    // System.out.println(buf.inspect());
    long out = proto.readI64();
    if (out != n) {
      throw new RuntimeException("I64 was supposed to be " + n + " but was " + out);
    }
  }
View Full Code Here

    });
  }

  public static void testDouble() throws Exception {
    TMemoryBuffer buf = new TMemoryBuffer(1000);
    TProtocol proto = factory.getProtocol(buf);
    proto.writeDouble(123.456);
    double out = proto.readDouble();
    if (out != 123.456) {
      throw new RuntimeException("Double was supposed to be " + 123.456 + " but was " + out);
    }
  }
View Full Code Here

    }
  }

  public static void testNakedString(String str) throws Exception {
    TMemoryBuffer buf = new TMemoryBuffer(0);
    TProtocol proto = factory.getProtocol(buf);
    proto.writeString(str);
    // System.out.println(buf.inspect());
    String out = proto.readString();
    if (!str.equals(out)) {
      throw new RuntimeException("String was supposed to be '" + str + "' but was '" + out + "'");
    }
  }
View Full Code Here

    });
  }

  public static void testNakedBinary(byte[] data) throws Exception {
    TMemoryBuffer buf = new TMemoryBuffer(0);
    TProtocol proto = factory.getProtocol(buf);
    proto.writeBinary(data);
    // System.out.println(buf.inspect());
    byte[] out = proto.readBinary();
    if (!Arrays.equals(data, out)) {
      throw new RuntimeException("Binary was supposed to be '" + data + "' but was '" + out + "'");
    }
  }
View Full Code Here

TOP

Related Classes of com.facebook.thrift.protocol.TProtocol

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.