當前位置: 首頁>>代碼示例>>Java>>正文


Java CodedOutputStream.computeUInt64Size方法代碼示例

本文整理匯總了Java中com.google.protobuf.CodedOutputStream.computeUInt64Size方法的典型用法代碼示例。如果您正苦於以下問題:Java CodedOutputStream.computeUInt64Size方法的具體用法?Java CodedOutputStream.computeUInt64Size怎麽用?Java CodedOutputStream.computeUInt64Size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.protobuf.CodedOutputStream的用法示例。


在下文中一共展示了CodedOutputStream.computeUInt64Size方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSerializedSize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
public int getSerializedSize() {
	int size = this.memoizedSerializedSize;
	if(size != -1) {
		return size;
	} else {
		size = 0;
		if((this.bitField0_ & 1) == 1) {
			size += CodedOutputStream.computeBytesSize(1, this.getDestinationBytes());
		}

		if((this.bitField0_ & 2) == 2) {
			size += CodedOutputStream.computeUInt64Size(2, this.timestamp_);
		}

		size += this.getUnknownFields().getSerializedSize();
		this.memoizedSerializedSize = size;
		return size;
	}
}
 
開發者ID:Agilitum,項目名稱:TextSecureSMP,代碼行數:20,代碼來源:PushSMPMessageProtos.java

示例2: getSerializedSize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
public int getSerializedSize() {
	int size = memoizedSerializedSize;
	if (size != -1) return size;

	size = 0;
	if (((bitField0_ & 0x00000001) == 0x00000001)) {
		size += CodedOutputStream
				.computeUInt32Size(1, session_);
	}
	if (((bitField0_ & 0x00000002) == 0x00000002)) {
		size += CodedOutputStream
				.computeUInt32Size(2, maxBandwidth_);
	}
	if (((bitField0_ & 0x00000004) == 0x00000004)) {
		size += CodedOutputStream
				.computeBytesSize(3, getWelcomeTextBytes());
	}
	if (((bitField0_ & 0x00000008) == 0x00000008)) {
		size += CodedOutputStream
				.computeUInt64Size(4, permissions_);
	}
	size += getUnknownFields().getSerializedSize();
	memoizedSerializedSize = size;
	return size;
}
 
開發者ID:wjlafrance,項目名稱:grumble,代碼行數:26,代碼來源:Mumble.java

示例3: getSerializedPointSize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
public int getSerializedPointSize(Track.TrackPoint point) {
    int size = 0;
    size += CodedOutputStream.computeInt32Size(FIELD_POINT_LATITUDE, point.latitudeE6);
    size += CodedOutputStream.computeInt32Size(FIELD_POINT_LONGITUDE, point.longitudeE6);
    size += CodedOutputStream.computeFloatSize(FIELD_POINT_ALTITUDE, point.elevation);
    size += CodedOutputStream.computeFloatSize(FIELD_POINT_SPEED, point.speed);
    size += CodedOutputStream.computeFloatSize(FIELD_POINT_BEARING, point.bearing);
    size += CodedOutputStream.computeFloatSize(FIELD_POINT_ACCURACY, point.accuracy);
    size += CodedOutputStream.computeUInt64Size(FIELD_POINT_TIMESTAMP, point.time);
    if (!point.continuous) {
        //noinspection ConstantConditions
        size += CodedOutputStream.computeBoolSize(FIELD_POINT_CONTINUOUS, point.continuous);
    }
    return size;
}
 
開發者ID:andreynovikov,項目名稱:trekarta,代碼行數:16,代碼來源:TrackManager.java

示例4: computeSize

import com.google.protobuf.CodedOutputStream; //導入方法依賴的package包/類
private int computeSize(FieldInfo fieldInfo, Object value) throws IOException {
	FieldType fieldType = fieldInfo.getFieldType();

	int size = 0;
	if (value instanceof List) {
		// if list
		size = CodedConstant.computeListSize(fieldInfo.getOrder(), (List) value, fieldInfo.getFieldType(), true, null);
		return size;
	}

	int order = fieldInfo.getOrder();
	switch (fieldType) {
	case DOUBLE:
		size = CodedOutputStream.computeDoubleSize(order, (Double) value);
		break;
	case BYTES:
		ByteString bytes = ByteString.copyFrom((byte[]) value);
		size = CodedOutputStream.computeBytesSize(order, bytes);
		break;
	case STRING:
		ByteString string = ByteString.copyFromUtf8(value.toString());
		size = CodedOutputStream.computeBytesSize(order, string);
		break;
	case BOOL:
		size = CodedOutputStream.computeBoolSize(order, (Boolean) value);
		break;
	case FIXED32:
		size = CodedOutputStream.computeFixed32Size(order, (Integer) value);
		break;
	case SFIXED32:
		size = CodedOutputStream.computeSFixed32Size(order, (Integer) value);
		break;
	case SINT32:
		size = CodedOutputStream.computeSInt32Size(order, (Integer) value);
		break;
	case INT32:
		size = CodedOutputStream.computeInt32Size(order, (Integer) value);
		break;
	case UINT32:
		size = CodedOutputStream.computeUInt32Size(order, (Integer) value);
		break;
	case FIXED64:
		size = CodedOutputStream.computeFixed64Size(order, (Long) value);
		break;
	case SFIXED64:
		size = CodedOutputStream.computeSFixed64Size(order, (Long) value);
		break;
	case SINT64:
		size = CodedOutputStream.computeSInt64Size(order, (Long) value);
		break;
	case INT64:
		size = CodedOutputStream.computeInt64Size(order, (Long) value);
		break;
	case UINT64:
		size = CodedOutputStream.computeUInt64Size(order, (Long) value);
		break;
	case ENUM:
		int i;
		i = getEnumValue(value);
		size = CodedOutputStream.computeEnumSize(order, i);
		break;
	case FLOAT:
		size = CodedOutputStream.computeFloatSize(order, (Float) value);
		break;
	case OBJECT:
		Class c = value.getClass();
		ReflectiveCodec codec = new ReflectiveCodec(c);
		
		int objectSize = codec.size(value);
		
		size = size + CodedOutputStream.computeRawVarint32Size(objectSize);
		size = size + CodedOutputStream.computeTagSize(order);
		
		size += objectSize;
		break;
	default:
		throw new IOException("Unknown field type on field '" + fieldInfo.getField().getName() + "'");
	}

	return size;
}
 
開發者ID:jhunters,項目名稱:jprotobuf,代碼行數:82,代碼來源:ReflectiveCodec.java


注:本文中的com.google.protobuf.CodedOutputStream.computeUInt64Size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。