Examples of TIOStreamTransport


Examples of org.apache.thrift.transport.TIOStreamTransport

   * @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

Examples of org.apache.thrift.transport.TIOStreamTransport

      deserialize(tb, bytes);
      return;
    }

    TProtocol iprot = protocolFactory_.getProtocol(
        new TIOStreamTransport(
          new ByteArrayInputStream(bytes)));

    // index into field ID path being currently searched for
    int curPathIndex = 0;
View Full Code Here

Examples of org.apache.thrift.transport.TIOStreamTransport

    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

Examples of org.apache.thrift.transport.TIOStreamTransport

    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

Examples of org.apache.thrift.transport.TIOStreamTransport

        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

Examples of org.apache.thrift.transport.TIOStreamTransport

                            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

Examples of org.apache.thrift.transport.TIOStreamTransport

                      TProtocolFactory protocolFactory) {
        Preconditions.checkNotNull(serializedStruct, "ttype is null");
        Preconditions.checkNotNull(clazz, "clazz is null");
        try {
            ByteArrayInputStream istream = new ByteArrayInputStream(serializedStruct);
            TIOStreamTransport resultIOStream = new TIOStreamTransport(istream);
            TProtocol resultProtocolBuffer = protocolFactory.getProtocol(resultIOStream);
            return read(clazz, resultProtocolBuffer);
        } catch (Exception e) {
            throw Throwables.propagate(e);
        }
View Full Code Here

Examples of org.apache.thrift.transport.TIOStreamTransport

                          ByteArrayOutputStream oStream,
                          TProtocolFactory protocolFactory) {
        Preconditions.checkNotNull(ttype, "ttype is null");
        Preconditions.checkNotNull(protocolFactory, "protocolFactory is null");
        try {
            TIOStreamTransport resultIOStream = new TIOStreamTransport(oStream);
            TProtocol resultProtocolBuffer = protocolFactory.getProtocol(resultIOStream);
            write((Class<T>) ttype.getClass(), ttype, resultProtocolBuffer);
        } catch (Exception e) {
            throw Throwables.propagate(e);
        }
View Full Code Here

Examples of org.apache.thrift.transport.TIOStreamTransport

    /**
     * Wrap the read buffer in a memory-based transport so a processor can read
     * the data it needs to handle an invocation.
     */
    private TTransport getInputTransport() {
      return inputTransportFactory_.getTransport(new TIOStreamTransport(
        new ByteArrayInputStream(buffer_.array())));
    }
View Full Code Here

Examples of org.apache.thrift.transport.TIOStreamTransport

    /**
     * Get the transport that should be used by the invoker for responding.
     */
    private TTransport getOutputTransport() {
      response_ = new TByteArrayOutputStream();
      return outputTransportFactory_.getTransport(new TIOStreamTransport(response_));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.