com.xiaomi.infra.galaxy.io.thrift.RSFileHeader Maven / Gradle / Ivy
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.xiaomi.infra.galaxy.io.thrift;
import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;
import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
/**
* 文件头
*/
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-8-10")
public class RSFileHeader implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("RSFileHeader");
private static final libthrift091.protocol.TField MAGIC_FIELD_DESC = new libthrift091.protocol.TField("magic", libthrift091.protocol.TType.STRING, (short)1);
private static final libthrift091.protocol.TField VERSION_FIELD_DESC = new libthrift091.protocol.TField("version", libthrift091.protocol.TType.I32, (short)2);
private static final libthrift091.protocol.TField COMPRESSION_FIELD_DESC = new libthrift091.protocol.TField("compression", libthrift091.protocol.TType.I32, (short)3);
private static final libthrift091.protocol.TField CHECKSUM_FIELD_DESC = new libthrift091.protocol.TField("checksum", libthrift091.protocol.TType.I32, (short)4);
private static final libthrift091.protocol.TField COUNT_FIELD_DESC = new libthrift091.protocol.TField("count", libthrift091.protocol.TType.I64, (short)5);
private static final libthrift091.protocol.TField METADATA_FIELD_DESC = new libthrift091.protocol.TField("metadata", libthrift091.protocol.TType.STRING, (short)6);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new RSFileHeaderStandardSchemeFactory());
schemes.put(TupleScheme.class, new RSFileHeaderTupleSchemeFactory());
}
/**
* Magic常量,固定为"RSF"
*/
public String magic; // optional
/**
* 版本号
*/
public int version; // optional
/**
* 压缩算法类型
* 可选,进行压缩的区域为文件中除文件头之外其余部分
*
* @see Compression
*/
public Compression compression; // optional
/**
* 数据完整性校验算法类型
* 可选,对每条记录对data部分进行校验
*
* @see Checksum
*/
public Checksum checksum; // optional
/**
* 记录数目,不含最后EOF记录,可选
*/
public long count; // optional
/**
* 元信息,内容由使用者自己定义
*/
public ByteBuffer metadata; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements libthrift091.TFieldIdEnum {
/**
* Magic常量,固定为"RSF"
*/
MAGIC((short)1, "magic"),
/**
* 版本号
*/
VERSION((short)2, "version"),
/**
* 压缩算法类型
* 可选,进行压缩的区域为文件中除文件头之外其余部分
*
* @see Compression
*/
COMPRESSION((short)3, "compression"),
/**
* 数据完整性校验算法类型
* 可选,对每条记录对data部分进行校验
*
* @see Checksum
*/
CHECKSUM((short)4, "checksum"),
/**
* 记录数目,不含最后EOF记录,可选
*/
COUNT((short)5, "count"),
/**
* 元信息,内容由使用者自己定义
*/
METADATA((short)6, "metadata");
private static final Map byName = new HashMap();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // MAGIC
return MAGIC;
case 2: // VERSION
return VERSION;
case 3: // COMPRESSION
return COMPRESSION;
case 4: // CHECKSUM
return CHECKSUM;
case 5: // COUNT
return COUNT;
case 6: // METADATA
return METADATA;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __VERSION_ISSET_ID = 0;
private static final int __COUNT_ISSET_ID = 1;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.MAGIC,_Fields.VERSION,_Fields.COMPRESSION,_Fields.CHECKSUM,_Fields.COUNT,_Fields.METADATA};
public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.MAGIC, new libthrift091.meta_data.FieldMetaData("magic", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.VERSION, new libthrift091.meta_data.FieldMetaData("version", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.I32)));
tmpMap.put(_Fields.COMPRESSION, new libthrift091.meta_data.FieldMetaData("compression", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.EnumMetaData(libthrift091.protocol.TType.ENUM, Compression.class)));
tmpMap.put(_Fields.CHECKSUM, new libthrift091.meta_data.FieldMetaData("checksum", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.EnumMetaData(libthrift091.protocol.TType.ENUM, Checksum.class)));
tmpMap.put(_Fields.COUNT, new libthrift091.meta_data.FieldMetaData("count", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.I64)));
tmpMap.put(_Fields.METADATA, new libthrift091.meta_data.FieldMetaData("metadata", libthrift091.TFieldRequirementType.OPTIONAL,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING , true)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(RSFileHeader.class, metaDataMap);
}
public RSFileHeader() {
this.count = -1L;
}
/**
* Performs a deep copy on other.
*/
public RSFileHeader(RSFileHeader other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetMagic()) {
this.magic = other.magic;
}
this.version = other.version;
if (other.isSetCompression()) {
this.compression = other.compression;
}
if (other.isSetChecksum()) {
this.checksum = other.checksum;
}
this.count = other.count;
if (other.isSetMetadata()) {
this.metadata = libthrift091.TBaseHelper.copyBinary(other.metadata);
}
}
public RSFileHeader deepCopy() {
return new RSFileHeader(this);
}
@Override
public void clear() {
this.magic = null;
setVersionIsSet(false);
this.version = 0;
this.compression = null;
this.checksum = null;
this.count = -1L;
this.metadata = null;
}
/**
* Magic常量,固定为"RSF"
*/
public String getMagic() {
return this.magic;
}
/**
* Magic常量,固定为"RSF"
*/
public RSFileHeader setMagic(String magic) {
this.magic = magic;
return this;
}
public void unsetMagic() {
this.magic = null;
}
/** Returns true if field magic is set (has been assigned a value) and false otherwise */
public boolean isSetMagic() {
return this.magic != null;
}
public void setMagicIsSet(boolean value) {
if (!value) {
this.magic = null;
}
}
/**
* 版本号
*/
public int getVersion() {
return this.version;
}
/**
* 版本号
*/
public RSFileHeader setVersion(int version) {
this.version = version;
setVersionIsSet(true);
return this;
}
public void unsetVersion() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VERSION_ISSET_ID);
}
/** Returns true if field version is set (has been assigned a value) and false otherwise */
public boolean isSetVersion() {
return EncodingUtils.testBit(__isset_bitfield, __VERSION_ISSET_ID);
}
public void setVersionIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VERSION_ISSET_ID, value);
}
/**
* 压缩算法类型
* 可选,进行压缩的区域为文件中除文件头之外其余部分
*
* @see Compression
*/
public Compression getCompression() {
return this.compression;
}
/**
* 压缩算法类型
* 可选,进行压缩的区域为文件中除文件头之外其余部分
*
* @see Compression
*/
public RSFileHeader setCompression(Compression compression) {
this.compression = compression;
return this;
}
public void unsetCompression() {
this.compression = null;
}
/** Returns true if field compression is set (has been assigned a value) and false otherwise */
public boolean isSetCompression() {
return this.compression != null;
}
public void setCompressionIsSet(boolean value) {
if (!value) {
this.compression = null;
}
}
/**
* 数据完整性校验算法类型
* 可选,对每条记录对data部分进行校验
*
* @see Checksum
*/
public Checksum getChecksum() {
return this.checksum;
}
/**
* 数据完整性校验算法类型
* 可选,对每条记录对data部分进行校验
*
* @see Checksum
*/
public RSFileHeader setChecksum(Checksum checksum) {
this.checksum = checksum;
return this;
}
public void unsetChecksum() {
this.checksum = null;
}
/** Returns true if field checksum is set (has been assigned a value) and false otherwise */
public boolean isSetChecksum() {
return this.checksum != null;
}
public void setChecksumIsSet(boolean value) {
if (!value) {
this.checksum = null;
}
}
/**
* 记录数目,不含最后EOF记录,可选
*/
public long getCount() {
return this.count;
}
/**
* 记录数目,不含最后EOF记录,可选
*/
public RSFileHeader setCount(long count) {
this.count = count;
setCountIsSet(true);
return this;
}
public void unsetCount() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COUNT_ISSET_ID);
}
/** Returns true if field count is set (has been assigned a value) and false otherwise */
public boolean isSetCount() {
return EncodingUtils.testBit(__isset_bitfield, __COUNT_ISSET_ID);
}
public void setCountIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COUNT_ISSET_ID, value);
}
/**
* 元信息,内容由使用者自己定义
*/
public byte[] getMetadata() {
setMetadata(libthrift091.TBaseHelper.rightSize(metadata));
return metadata == null ? null : metadata.array();
}
public ByteBuffer bufferForMetadata() {
return libthrift091.TBaseHelper.copyBinary(metadata);
}
/**
* 元信息,内容由使用者自己定义
*/
public RSFileHeader setMetadata(byte[] metadata) {
this.metadata = metadata == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(metadata, metadata.length));
return this;
}
public RSFileHeader setMetadata(ByteBuffer metadata) {
this.metadata = libthrift091.TBaseHelper.copyBinary(metadata);
return this;
}
public void unsetMetadata() {
this.metadata = null;
}
/** Returns true if field metadata is set (has been assigned a value) and false otherwise */
public boolean isSetMetadata() {
return this.metadata != null;
}
public void setMetadataIsSet(boolean value) {
if (!value) {
this.metadata = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case MAGIC:
if (value == null) {
unsetMagic();
} else {
setMagic((String)value);
}
break;
case VERSION:
if (value == null) {
unsetVersion();
} else {
setVersion((Integer)value);
}
break;
case COMPRESSION:
if (value == null) {
unsetCompression();
} else {
setCompression((Compression)value);
}
break;
case CHECKSUM:
if (value == null) {
unsetChecksum();
} else {
setChecksum((Checksum)value);
}
break;
case COUNT:
if (value == null) {
unsetCount();
} else {
setCount((Long)value);
}
break;
case METADATA:
if (value == null) {
unsetMetadata();
} else {
setMetadata((ByteBuffer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case MAGIC:
return getMagic();
case VERSION:
return Integer.valueOf(getVersion());
case COMPRESSION:
return getCompression();
case CHECKSUM:
return getChecksum();
case COUNT:
return Long.valueOf(getCount());
case METADATA:
return getMetadata();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case MAGIC:
return isSetMagic();
case VERSION:
return isSetVersion();
case COMPRESSION:
return isSetCompression();
case CHECKSUM:
return isSetChecksum();
case COUNT:
return isSetCount();
case METADATA:
return isSetMetadata();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof RSFileHeader)
return this.equals((RSFileHeader)that);
return false;
}
public boolean equals(RSFileHeader that) {
if (that == null)
return false;
boolean this_present_magic = true && this.isSetMagic();
boolean that_present_magic = true && that.isSetMagic();
if (this_present_magic || that_present_magic) {
if (!(this_present_magic && that_present_magic))
return false;
if (!this.magic.equals(that.magic))
return false;
}
boolean this_present_version = true && this.isSetVersion();
boolean that_present_version = true && that.isSetVersion();
if (this_present_version || that_present_version) {
if (!(this_present_version && that_present_version))
return false;
if (this.version != that.version)
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_checksum = true && this.isSetChecksum();
boolean that_present_checksum = true && that.isSetChecksum();
if (this_present_checksum || that_present_checksum) {
if (!(this_present_checksum && that_present_checksum))
return false;
if (!this.checksum.equals(that.checksum))
return false;
}
boolean this_present_count = true && this.isSetCount();
boolean that_present_count = true && that.isSetCount();
if (this_present_count || that_present_count) {
if (!(this_present_count && that_present_count))
return false;
if (this.count != that.count)
return false;
}
boolean this_present_metadata = true && this.isSetMetadata();
boolean that_present_metadata = true && that.isSetMetadata();
if (this_present_metadata || that_present_metadata) {
if (!(this_present_metadata && that_present_metadata))
return false;
if (!this.metadata.equals(that.metadata))
return false;
}
return true;
}
@Override
public int hashCode() {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy