Examples of TIOStreamTransport


Examples of org.apache.thrift.transport.TIOStreamTransport

  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

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

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

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

            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

Examples of org.apache.thrift.transport.TIOStreamTransport

                        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

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

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

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
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.