Package org.apache.thrift.transport

Examples of org.apache.thrift.transport.TIOStreamTransport


          "org.apache.thrift.protocol");
      TProtocolFactory protFactory = TReflectionUtils
          .getProtocolFactoryByName(protoName);
      bos_ = new ByteStream.Output();
      bis_ = new ByteStream.Input();
      tios = new TIOStreamTransport(bis_, bos_);

      oprot_ = protFactory.getProtocol(tios);
      iprot_ = protFactory.getProtocol(tios);

      /**
 
View Full Code Here


        if (setUpComplete) {
            return;
        }

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        TIOStreamTransport transport = new TIOStreamTransport(out);
        TBinaryProtocol protocol = new TBinaryProtocol(transport);

        IntString intString = new IntString(1, "one", 1);
        intString.write(protocol);
        BytesWritable bytesWritable = new BytesWritable(out.toByteArray());
View Full Code Here

        SequenceFile.Writer seqFileWriter = SequenceFile.createWriter(
            intStringSeq.getFileSystem(hiveConf), hiveConf, intStringSeq,
            NullWritable.class, BytesWritable.class);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        TIOStreamTransport transport = new TIOStreamTransport(out);
        TBinaryProtocol protocol = new TBinaryProtocol(transport);

        for (int i = 1; i <= 100; i++) {
            if (i % 10 == 0) {
                seqFileWriter.append(NullWritable.get(), new BytesWritable("bad record".getBytes()));
View Full Code Here

  protected TIOStreamTransport outTransport, inTransport;
  protected TProtocol outProtocol, inProtocol;

  private void init(TProtocolFactory inFactory, TProtocolFactory outFactory) throws Exception {
    outTransport = new TIOStreamTransport(bos);
    inTransport = new TIOStreamTransport(bis);
    outProtocol = outFactory.getProtocol(outTransport);
    inProtocol = inFactory.getProtocol(inTransport);
  }
View Full Code Here

          "org.apache.thrift.protocol");
      TProtocolFactory protFactory = TReflectionUtils
          .getProtocolFactoryByName(protoName);
      bos_ = new ByteStream.Output();
      bis_ = new ByteStream.Input();
      tios = new TIOStreamTransport(bis_, bos_);

      oprot_ = protFactory.getProtocol(tios);
      iprot_ = protFactory.getProtocol(tios);

      /**
 
View Full Code Here

    if (args.length != 2) {
      System.out.println("usage: java -cp build/classes org.apache.thrift.test.ReadStruct filename proto_factory_class");
      System.out.println("Read in an instance of CompactProtocolTestStruct from 'file', making sure that it is equivalent to Fixtures.compactProtoTestStruct. Use a protocol from 'proto_factory_class'.");
    }

    TTransport trans = new TIOStreamTransport(new BufferedInputStream(new FileInputStream(args[0])));

    TProtocolFactory factory = (TProtocolFactory)Class.forName(args[1]).newInstance();

    TProtocol proto = factory.getProtocol(trans);
View Full Code Here

   * @param bytes The array to read from
   */
  public void deserialize(TBase base, byte[] bytes) throws TException {
    base.read(
        protocolFactory_.getProtocol(
          new TIOStreamTransport(
            new ByteArrayInputStream(bytes))));
  }
View Full Code Here

            throw new WebApplicationException(e);
        }
    }

    static <T extends TBase> T unmarshal(Class<T> type, MediaType mediaType, InputStream entityStream) throws Exception {
        TIOStreamTransport transport = new TIOStreamTransport(entityStream);
        TProtocol protocol = null;
        if (THRIFT_TYPE.isCompatible(mediaType)) {
            protocol = new TBinaryProtocol.Factory().getProtocol(transport);
        } else if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType)) {
            protocol = new TJSONProtocol.Factory().getProtocol(transport);
View Full Code Here

                        OutputStream entityStream) throws IOException, WebApplicationException {
        marshal(t, mediaType, entityStream);
    }

    static <T extends TBase> void marshal(T t, MediaType mediaType, OutputStream entityStream) throws IOException {
        TIOStreamTransport transport = new TIOStreamTransport(entityStream);
        TProtocol protocol = null;
        if (THRIFT_TYPE.isCompatible(mediaType)) {
            protocol = new TBinaryProtocol.Factory().getProtocol(transport);
        } else if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType)) {
            protocol = new TJSONProtocol.Factory().getProtocol(transport);
View Full Code Here

    if (args.length != 2) {
      System.out.println("usage: java -cp build/classes org.apache.thrift.test.WriteStruct filename proto_factory_class");
      System.out.println("Write out an instance of Fixtures.compactProtocolTestStruct to 'file'. Use a protocol from 'proto_factory_class'.");
    }
   
    TTransport trans = new TIOStreamTransport(new BufferedOutputStream(new FileOutputStream(args[0])));
   
    TProtocolFactory factory = (TProtocolFactory)Class.forName(args[1]).newInstance();
   
    TProtocol proto = factory.getProtocol(trans);
   
    Fixtures.compactProtoTestStruct.write(proto);
    trans.flush();
  }
View Full Code Here

TOP

Related Classes of org.apache.thrift.transport.TIOStreamTransport

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.