コード例 #1
0
ファイル: FileHandle.java プロジェクト: pacheco/GlobalFS
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, FileHandle struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(3);
   if (incoming.get(0)) {
     struct.id = iprot.readI64();
     struct.setIdIsSet(true);
   }
   if (incoming.get(1)) {
     struct.flags = iprot.readI32();
     struct.setFlagsIsSet(true);
   }
   if (incoming.get(2)) {
     struct.partition = iprot.readByte();
     struct.setPartitionIsSet(true);
   }
 }
コード例 #2
0
ファイル: FileHandle.java プロジェクト: pacheco/GlobalFS
    public void read(org.apache.thrift.protocol.TProtocol iprot, FileHandle struct)
        throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true) {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.id = iprot.readI64();
              struct.setIdIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // FLAGS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.flags = iprot.readI32();
              struct.setFlagsIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // PARTITION
            if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
              struct.partition = iprot.readByte();
              struct.setPartitionIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }