Пример #1
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, THdfsFileDesc struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   struct.file_name = iprot.readString();
   struct.setFile_nameIsSet(true);
   struct.length = iprot.readI64();
   struct.setLengthIsSet(true);
   struct.compression = THdfsCompression.findByValue(iprot.readI32());
   struct.setCompressionIsSet(true);
   struct.last_modification_time = iprot.readI64();
   struct.setLast_modification_timeIsSet(true);
   {
     org.apache.thrift.protocol.TList _list39 =
         new org.apache.thrift.protocol.TList(
             org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
     struct.file_blocks = new ArrayList<THdfsFileBlock>(_list39.size);
     for (int _i40 = 0; _i40 < _list39.size; ++_i40) {
       THdfsFileBlock _elem41; // required
       _elem41 = new THdfsFileBlock();
       _elem41.read(iprot);
       struct.file_blocks.add(_elem41);
     }
   }
   struct.setFile_blocksIsSet(true);
 }
Пример #2
0
 /** Performs a deep copy on <i>other</i>. */
 public THdfsFileDesc(THdfsFileDesc other) {
   __isset_bitfield = other.__isset_bitfield;
   if (other.isSetFile_name()) {
     this.file_name = other.file_name;
   }
   this.length = other.length;
   if (other.isSetCompression()) {
     this.compression = other.compression;
   }
   this.last_modification_time = other.last_modification_time;
   if (other.isSetFile_blocks()) {
     List<THdfsFileBlock> __this__file_blocks = new ArrayList<THdfsFileBlock>();
     for (THdfsFileBlock other_element : other.file_blocks) {
       __this__file_blocks.add(new THdfsFileBlock(other_element));
     }
     this.file_blocks = __this__file_blocks;
   }
 }
Пример #3
0
  public boolean equals(THdfsFileDesc that) {
    if (that == null) return false;

    boolean this_present_file_name = true && this.isSetFile_name();
    boolean that_present_file_name = true && that.isSetFile_name();
    if (this_present_file_name || that_present_file_name) {
      if (!(this_present_file_name && that_present_file_name)) return false;
      if (!this.file_name.equals(that.file_name)) return false;
    }

    boolean this_present_length = true;
    boolean that_present_length = true;
    if (this_present_length || that_present_length) {
      if (!(this_present_length && that_present_length)) return false;
      if (this.length != that.length) return false;
    }

    boolean this_present_compression = true && this.isSetCompression();
    boolean that_present_compression = true && that.isSetCompression();
    if (this_present_compression || that_present_compression) {
      if (!(this_present_compression && that_present_compression)) return false;
      if (!this.compression.equals(that.compression)) return false;
    }

    boolean this_present_last_modification_time = true;
    boolean that_present_last_modification_time = true;
    if (this_present_last_modification_time || that_present_last_modification_time) {
      if (!(this_present_last_modification_time && that_present_last_modification_time))
        return false;
      if (this.last_modification_time != that.last_modification_time) return false;
    }

    boolean this_present_file_blocks = true && this.isSetFile_blocks();
    boolean that_present_file_blocks = true && that.isSetFile_blocks();
    if (this_present_file_blocks || that_present_file_blocks) {
      if (!(this_present_file_blocks && that_present_file_blocks)) return false;
      if (!this.file_blocks.equals(that.file_blocks)) return false;
    }

    return true;
  }
Пример #4
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, THdfsFileDesc struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.file_name != null) {
        oprot.writeFieldBegin(FILE_NAME_FIELD_DESC);
        oprot.writeString(struct.file_name);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(LENGTH_FIELD_DESC);
      oprot.writeI64(struct.length);
      oprot.writeFieldEnd();
      if (struct.compression != null) {
        oprot.writeFieldBegin(COMPRESSION_FIELD_DESC);
        oprot.writeI32(struct.compression.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(LAST_MODIFICATION_TIME_FIELD_DESC);
      oprot.writeI64(struct.last_modification_time);
      oprot.writeFieldEnd();
      if (struct.file_blocks != null) {
        oprot.writeFieldBegin(FILE_BLOCKS_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRUCT, struct.file_blocks.size()));
          for (THdfsFileBlock _iter37 : struct.file_blocks) {
            _iter37.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Пример #5
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();
    }
Пример #6
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;
  }