当前位置: 首页>>代码示例>>Java>>正文


Java ExtensionRegistryLite类代码示例

本文整理汇总了Java中com.google.protobuf.ExtensionRegistryLite的典型用法代码示例。如果您正苦于以下问题:Java ExtensionRegistryLite类的具体用法?Java ExtensionRegistryLite怎么用?Java ExtensionRegistryLite使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExtensionRegistryLite类属于com.google.protobuf包,在下文中一共展示了ExtensionRegistryLite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mergeFrom

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
public PushSMPMessageProtos.PushSMPMessageContent.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException {
	PushSMPMessageProtos.PushSMPMessageContent parsedMessage = null;

	try {
		parsedMessage = (PushSMPMessageProtos.PushSMPMessageContent)PushSMPMessageProtos.PushSMPMessageContent.PARSER.parsePartialFrom(input, extensionRegistry);
	} catch (InvalidProtocolBufferException var8) {
		parsedMessage = (PushSMPMessageProtos.PushSMPMessageContent)var8.getUnfinishedMessage();
		throw var8;
	} finally {
		if(parsedMessage != null) {
			this.mergeFrom(parsedMessage);
		}

	}

	return this;
}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:18,代码来源:PushSMPMessageProtos.java

示例2: parseField

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
/**
 * Parses the field.
 *
 * @param <T> the generic type
 * @param input the input
 * @param extensionRegistry the extension registry
 * @param type the type
 * @param value the value
 * @return the t
 * @throws IOException Signals that an I/O exception has occurred.
 */
@SuppressWarnings("unchecked")
static <T> T parseField(CodedInputStream input, ExtensionRegistryLite extensionRegistry, WireFormat.FieldType type,
        T value) throws IOException {
    switch (type) {
        case MESSAGE:
            int length = input.readRawVarint32();
            final int oldLimit = input.pushLimit(length);
            Codec<? extends Object> codec = ProtobufProxy.create(value.getClass());
            T ret = (T) codec.decode(input.readRawBytes(length));
            input.popLimit(oldLimit);
            return ret;
        case ENUM:
            return (T) (java.lang.Integer) input.readEnum();
        case GROUP:
            throw new RuntimeException("Groups are not allowed in maps.");
        default:
            return (T) CodedConstant.readPrimitiveField(input, type, true);
    }
}
 
开发者ID:jhunters,项目名称:jprotobuf,代码行数:31,代码来源:MapEntryLite.java

示例3: mergeFrom

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
public Builder mergeFrom(
		CodedInputStream input,
		ExtensionRegistryLite extensionRegistry)
		throws IOException {
	MumbleProto.Mumble.Version parsedMessage = null;
	try {
		parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
	} catch (InvalidProtocolBufferException e) {
		parsedMessage = (MumbleProto.Mumble.Version) e.getUnfinishedMessage();
		throw e;
	} finally {
		if (parsedMessage != null) {
			mergeFrom(parsedMessage);
		}
	}
	return this;
}
 
开发者ID:wjlafrance,项目名称:grumble,代码行数:18,代码来源:Mumble.java

示例4: ProtobufDecoder

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
public ProtobufDecoder(MessageLite prototype, ExtensionRegistryLite extensionRegistry) {
    if (prototype == null) {
        throw new NullPointerException("prototype");
    }
    this.prototype = prototype.getDefaultInstanceForType();
    this.extensionRegistry = extensionRegistry;
}
 
开发者ID:ninelook,项目名称:wecard-server,代码行数:8,代码来源:ProtobufDecoder.java

示例5: parse

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
@Override
public DynamicMessage parse(InputStream inputStream) {
  try {
    return DynamicMessage.newBuilder(messageDescriptor)
        .mergeFrom(inputStream, ExtensionRegistryLite.getEmptyRegistry())
        .build();
  } catch (IOException e) {
    throw new RuntimeException("Unable to merge from the supplied input stream", e);
  }
}
 
开发者ID:grpc-ecosystem,项目名称:polyglot,代码行数:11,代码来源:DynamicMessageMarshaller.java

示例6: readMessage

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
/** Read an embedded message field value from the stream. */
public void readMessage(final ByteBufMessageBuilder builder, final ExtensionRegistryLite extensionRegistry)
        throws IOException {
    final int length = readRawVarint32();

    int writerIdx = buf.writerIndex();
    buf.writerIndex(buf.readerIndex() + length);
    builder.mergeFrom(this, extensionRegistry);
    checkLastTagWas(0);
    buf.writerIndex(writerIdx);
}
 
开发者ID:apache,项目名称:incubator-pulsar,代码行数:12,代码来源:ByteBufCodedInputStream.java

示例7: ProtobufLiteDecoder

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
public ProtobufLiteDecoder(MessageLite prototype, ExtensionRegistryLite extensionRegistry)
{
	if (prototype == null)
	{
		throw new NullPointerException("prototype");
	}
	this.prototype = prototype.getDefaultInstanceForType();
	this.extensionRegistry = extensionRegistry;
}
 
开发者ID:mornsun,项目名称:bdclient,代码行数:10,代码来源:ProtobufLiteDecoder.java

示例8: SyncMessageContext

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
private SyncMessageContext(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException {
	this.memoizedIsInitialized = -1;
	this.memoizedSerializedSize = -1;
	this.initFields();
	boolean mutable_bitField0_ = false;
	com.google.protobuf.UnknownFieldSet.Builder unknownFields = UnknownFieldSet.newBuilder();

	try {
		boolean e = false;

		while(!e) {
			int tag = input.readTag();
			switch(tag) {
				case 0:
					e = true;
					break;
				case 10:
					this.bitField0_ |= 1;
					this.destination_ = input.readBytes();
					break;
				case 16:
					this.bitField0_ |= 2;
					this.timestamp_ = input.readUInt64();
					break;
				default:
					if(!this.parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
						e = true;
					}
			}
		}
	} catch (InvalidProtocolBufferException var11) {
		throw var11.setUnfinishedMessage(this);
	} catch (IOException var12) {
		throw (new InvalidProtocolBufferException(var12.getMessage())).setUnfinishedMessage(this);
	} finally {
		this.unknownFields = unknownFields.build();
		this.makeExtensionsImmutable();
	}

}
 
开发者ID:Agilitum,项目名称:TextSecureSMP,代码行数:41,代码来源:PushSMPMessageProtos.java

示例9: protoDeserialize

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
/**
 * @param bytes       字节数据
 * @param messageLite 序列化对应的类型
 * @return
 * @throws JRedisCacheException
 */
public static MessageLite protoDeserialize(byte[] bytes, MessageLite messageLite) throws JRedisCacheException {
    assert (bytes != null && messageLite != null);
    try {
        return messageLite.getParserForType().parsePartialFrom(CodedInputStream.newInstance(bytes), ExtensionRegistryLite.getEmptyRegistry());
    } catch (InvalidProtocolBufferException e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:chenleijava,项目名称:springJredisCache,代码行数:16,代码来源:JRedisSerializationUtils.java

示例10: parseInto

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
/**
 * Parses an entry off of the input into the map. This helper avoids allocaton of a {@link MapEntryLite} by parsing
 * directly into the provided {@link MapFieldLite}.
 *
 * @param map the map
 * @param input the input
 * @param extensionRegistry the extension registry
 * @throws IOException Signals that an I/O exception has occurred.
 */
public void parseInto(MapFieldLite<K, V> map, CodedInputStream input, ExtensionRegistryLite extensionRegistry)
        throws IOException {
    int length = input.readRawVarint32();
    final int oldLimit = input.pushLimit(length);
    K key = metadata.defaultKey;
    V value = metadata.defaultValue;

    while (true) {
        int tag = input.readTag();
        if (tag == 0) {
            break;
        }
        if (tag == CodedConstant.makeTag(KEY_FIELD_NUMBER, metadata.keyType.getWireType())) {
            key = parseField(input, extensionRegistry, metadata.keyType, key);
        } else if (tag == CodedConstant.makeTag(VALUE_FIELD_NUMBER, metadata.valueType.getWireType())) {
            value = parseField(input, extensionRegistry, metadata.valueType, value);
        } else {
            if (!input.skipField(tag)) {
                break;
            }
        }
    }

    input.checkLastTagWas(0);
    input.popLimit(oldLimit);
    map.put(key, value);
}
 
开发者ID:jhunters,项目名称:jprotobuf,代码行数:37,代码来源:MapEntryLite.java

示例11: Metadata

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
/**
 * Instantiates a new metadata.
 *
 * @param descriptor the descriptor
 * @param defaultInstance the default instance
 * @param keyType the key type
 * @param valueType the value type
 */
public Metadata(Descriptor descriptor, MapEntry<K, V> defaultInstance, WireFormat.FieldType keyType,
        WireFormat.FieldType valueType) {
    super(keyType, defaultInstance.key, valueType, defaultInstance.value);
    this.descriptor = descriptor;
    this.parser = new AbstractParser<MapEntry<K, V>>() {

        @Override
        public MapEntry<K, V> parsePartialFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
                throws InvalidProtocolBufferException {
            return new MapEntry<K, V>(Metadata.this, input, extensionRegistry);
        }
    };
}
 
开发者ID:jhunters,项目名称:jprotobuf,代码行数:22,代码来源:MapEntry.java

示例12: addDeserializationCode

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
@Override
public void addDeserializationCode(Context context) {
  String builderName = context.makeName("builder");
  context.builder.addStatement(
      "$T.Builder $L = $T.newBuilder()",
      context.getTypeName(),
      builderName,
      context.getTypeName());
  context.builder.addStatement(
      "codedIn.readMessage($L, $T.getEmptyRegistry())",
      builderName,
      ExtensionRegistryLite.class);
  context.builder.addStatement("$L = $L.build()", context.name, builderName);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:15,代码来源:Marshallers.java

示例13: ProtoResponseBodyConverter

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
ProtoResponseBodyConverter(Parser<T> parser, ExtensionRegistryLite registry) {
  this.parser = parser;
  this.registry = registry;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:ProtoResponseBodyConverter.java

示例14: createWithRegistry

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
/** Create an instance which uses {@code registry} when deserializing. */
public static ProtoConverterFactory createWithRegistry(ExtensionRegistryLite registry) {
  return new ProtoConverterFactory(registry);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:ProtoConverterFactory.java

示例15: ProtoConverterFactory

import com.google.protobuf.ExtensionRegistryLite; //导入依赖的package包/类
private ProtoConverterFactory(ExtensionRegistryLite registry) {
  this.registry = registry;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:ProtoConverterFactory.java


注:本文中的com.google.protobuf.ExtensionRegistryLite类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。