Ejemplo n.º 1
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, THdfsFileDesc 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: // FILE_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.file_name = iprot.readString();
              struct.setFile_nameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // LENGTH
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.length = iprot.readI64();
              struct.setLengthIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // COMPRESSION
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.compression = THdfsCompression.findByValue(iprot.readI32());
              struct.setCompressionIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // LAST_MODIFICATION_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.last_modification_time = iprot.readI64();
              struct.setLast_modification_timeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // FILE_BLOCKS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list34 = iprot.readListBegin();
                struct.file_blocks = new ArrayList<THdfsFileBlock>(_list34.size);
                for (int _i35 = 0; _i35 < _list34.size; ++_i35) {
                  THdfsFileBlock _elem36; // required
                  _elem36 = new THdfsFileBlock();
                  _elem36.read(iprot);
                  struct.file_blocks.add(_elem36);
                }
                iprot.readListEnd();
              }
              struct.setFile_blocksIsSet(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
      if (!struct.isSetLength()) {
        throw new org.apache.thrift.protocol.TProtocolException(
            "Required field 'length' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetLast_modification_time()) {
        throw new org.apache.thrift.protocol.TProtocolException(
            "Required field 'last_modification_time' was not found in serialized data! Struct: "
                + toString());
      }
      struct.validate();
    }
Ejemplo n.º 2
0
  public int compareTo(THdfsFileDesc other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    THdfsFileDesc typedOther = (THdfsFileDesc) other;

    lastComparison = Boolean.valueOf(isSetFile_name()).compareTo(typedOther.isSetFile_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFile_name()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.file_name, typedOther.file_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetLength()).compareTo(typedOther.isSetLength());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLength()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.length, typedOther.length);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCompression()).compareTo(typedOther.isSetCompression());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCompression()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.compression, typedOther.compression);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetLast_modification_time())
            .compareTo(typedOther.isSetLast_modification_time());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLast_modification_time()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(
              this.last_modification_time, typedOther.last_modification_time);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFile_blocks()).compareTo(typedOther.isSetFile_blocks());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFile_blocks()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.file_blocks, typedOther.file_blocks);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }