本文整理了Java中io.protostuff.Input.readFieldNumber()
方法的一些代码示例,展示了Input.readFieldNumber()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Input.readFieldNumber()
方法的具体详情如下:
包路径:io.protostuff.Input
类名称:Input
方法名:readFieldNumber
[英]Reads the field number of a message/object tied to the given Schema.
[中]读取绑定到给定架构的消息/对象的字段号。
代码示例来源:origin: protostuff/protostuff
public void mergeFrom(Input input, A message) throws IOException
{
for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch(number)
{
case 0:
return;
case 1:
message.value = input.readInt32();
break;
default:
input.handleUnknownField(number, this);
}
}
}
代码示例来源:origin: protostuff/protostuff
static void transferObject(Pipe.Schema<Object> pipeSchema, Pipe pipe,
Input input, Output output, IdStrategy strategy) throws IOException
{
if (ID_ENUM != input.readFieldNumber(pipeSchema.wrappedSchema))
throw new ProtostuffException("Corrupt input.");
strategy.transferEnumId(input, output, ID_ENUM);
if (ID_ENUM_VALUE != input.readFieldNumber(pipeSchema.wrappedSchema))
throw new ProtostuffException("Corrupt input.");
EnumIO.transfer(pipe, input, output, 1, false, strategy);
if (0 != input.readFieldNumber(pipeSchema.wrappedSchema))
throw new ProtostuffException("Corrupt input.");
}
代码示例来源:origin: protostuff/protostuff
protected Object readPrimitiveFrom(Input input, Object owner, int len)
throws IOException
{
int[] array = new int[len];
if (input instanceof GraphInput)
{
// update the actual reference.
((GraphInput) input).updateLast(array, owner);
}
for (int i = 0; i < len; i++)
{
if (ID_ARRAY_DATA != input.readFieldNumber(this))
throw new ProtostuffException("Corrupt input.");
array[i] = input.readInt32();
}
if (0 != input.readFieldNumber(this))
throw new ProtostuffException("Corrupt input.");
return array;
}
代码示例来源:origin: protostuff/protostuff
public void mergeFrom(Input input, SampleClass message) throws IOException
{
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch (number)
{
case 0:
return;
case 1:
if (message.testString == null)
message.testString = new ArrayList<String>();
message.testString.add(input.readString());
break;
default:
input.handleUnknownField(number, this);
}
}
}
代码示例来源:origin: protostuff/protostuff
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
if (message.someInt32 == null)
message.someInt32 = new ArrayList<Integer>();
message.someInt32.add(input.readInt32());
break;
case 2:
if (message.someFixed64 == null)
message.someFixed64 = new ArrayList<Long>();
message.someFixed64.add(input.readFixed64());
break;
default:
input.handleUnknownField(number, this);
代码示例来源:origin: protostuff/protostuff
@Override
public void mergeFrom(Input input, RequiresName message) throws IOException
{
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch (number)
{
case 0:
return;
case 1:
message.name = input.readString();
break;
case 2:
message.description = input.readString();
break;
default:
input.handleUnknownField(number, this);
}
}
}
代码示例来源:origin: protostuff/protostuff
@Override
public void mergeFrom(Input input, WrapperPojo message) throws IOException
{
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch (number)
{
case 0:
return;
case 1:
message.requiresName = input.mergeObject(message.requiresName, RequiresName.SCHEMA);
break;
default:
input.handleUnknownField(number, this);
}
}
}
代码示例来源:origin: dremio/dremio-oss
public void mergeFrom(Input input, FragmentPriority message) throws IOException
{
for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch(number)
{
case 0:
return;
case 1:
message.workloadClass = WorkloadClass.valueOf(input.readEnum());
break;
default:
input.handleUnknownField(number, this);
}
}
}
代码示例来源:origin: protostuff/protostuff
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
if (entry != input.mergeObject(entry, entrySchema))
throw new ProtostuffException("The map was incorrectly serialized.");
代码示例来源:origin: protostuff/protostuff
@Override
public Object readFrom(Input input, Object owner) throws IOException
{
if (ID_ARRAY_LEN != input.readFieldNumber(this))
throw new ProtostuffException("Corrupt input.");
final int len = input.readInt32();
String[] array = new String[len];
if (input instanceof GraphInput)
{
// update the actual reference.
((GraphInput) input).updateLast(array, owner);
}
for (int i = 0; i < len;)
{
switch (input.readFieldNumber(this))
{
case ID_ARRAY_DATA:
array[i++] = input.readString();
break;
case ID_ARRAY_NULLCOUNT:
i += input.readUInt32();
break;
default:
throw new ProtostuffException("Corrupt input.");
}
}
if (0 != input.readFieldNumber(this))
throw new ProtostuffException("Corrupt input.");
return array;
}
代码示例来源:origin: protostuff/protostuff
@Override
protected void transfer(Pipe pipe, Input input, Output output)
throws IOException
{
for (int number = input.readFieldNumber(wrappedSchema); number != 0; number = input
.readFieldNumber(wrappedSchema))
{
final Field<T> field = fieldsMap.getFieldByNumber(number);
if (field == null)
input.handleUnknownField(number, wrappedSchema);
else
field.transfer(pipe, input, output, field.repeated);
}
}
}
代码示例来源:origin: protostuff/protostuff
@Override
public void mergeFrom(Input input, Baz message) throws IOException
{
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch (number)
{
case 0:
return;
case 1:
message.id = input.readInt32();
break;
case 2:
message.name = input.readString();
break;
case 3:
message.timestamp = input.readInt64();
break;
default:
input.handleUnknownField(number, this);
}
}
}
代码示例来源:origin: protostuff/protostuff
@Override
public Object readFrom(Input input, Object owner) throws IOException
{
if (ID_ARRAY_LEN != input.readFieldNumber(this))
throw new ProtostuffException("Corrupt input.");
final int len = input.readInt32();
Object[] array = (Object[])Array.newInstance(hs.getSchema().typeClass(), len);
if (input instanceof GraphInput)
{
// update the actual reference.
((GraphInput) input).updateLast(array, owner);
}
for (int i = 0; i < len;)
{
switch (input.readFieldNumber(this))
{
case ID_ARRAY_DATA:
array[i++] = input.mergeObject(null, hs.getSchema());
break;
case ID_ARRAY_NULLCOUNT:
i += input.readUInt32();
break;
default:
throw new ProtostuffException("Corrupt input.");
}
}
if (0 != input.readFieldNumber(this))
throw new ProtostuffException("Corrupt input.");
return array;
}
代码示例来源:origin: org.apache.servicecomb/foundation-protobuf
@Override
public void mergeFrom(Input input, Object message) throws IOException {
input.readFieldNumber(null);
String typeUrl = input.readString();
input.readFieldNumber(null);
byte[] bytes = input.readByteArray();
input.readFieldNumber(null);
AnyEntry anyEntry = (AnyEntry) message;
anyEntry.setTypeUrl(typeUrl);
anyEntry.setValue(bytes);
}
代码示例来源:origin: protostuff/protostuff
@Override
public void mergeFrom(Input input, ClubFounder message) throws IOException
{
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch (number)
{
case 0:
return;
case 1:
message.name = input.readString();
break;
case 2:
message.club = input.mergeObject(message.club, Club.getSchema());
break;
default:
input.handleUnknownField(number, this);
}
}
}
代码示例来源:origin: protostuff/protostuff
@Override
public void mergeFrom(Input input, HasHasBar message) throws IOException
{
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch (number)
{
case 0:
return;
case 1:
message.name = input.readString();
break;
case 2:
message.hasBar = readHasBar(input);
break;
default:
input.handleUnknownField(number, this);
}
}
}
代码示例来源:origin: protostuff/protostuff
@Override
public Object readFrom(Input input, Object owner) throws IOException
{
if (ID_ARRAY_LEN != input.readFieldNumber(this))
throw new ProtostuffException("Corrupt input.");
final int len = input.readInt32();
return primitive ? readPrimitiveFrom(input, owner, len) :
readBoxedFrom(input, owner, len);
}
代码示例来源:origin: dremio/dremio-oss
public void mergeFrom(Input input, GetCatalogsReq message) throws IOException
{
for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch(number)
{
case 0:
return;
case 1:
message.catalogNameFilter = input.mergeObject(message.catalogNameFilter, LikeFilter.getSchema());
break;
default:
input.handleUnknownField(number, this);
}
}
}
代码示例来源:origin: dremio/dremio-oss
public void mergeFrom(Input input, FilterByType message) throws IOException
{
for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch(number)
{
case 0:
return;
case 1:
message.type = DataType.valueOf(input.readEnum())
;
break;
default:
input.handleUnknownField(number, this);
}
}
}
代码示例来源:origin: protostuff/protostuff
Object m = input.mergeObject(wrapper, strategy.POLYMORPHIC_MAP_SCHEMA);
if (!graph || !((GraphInput) input).isCurrentMessageReference())
m = wrapper.value;
if (1 != input.readFieldNumber(schema))
throw new ProtostuffException("Corrupt input.");
Object keyType = input.mergeObject(wrapper, strategy.CLASS_SCHEMA);
if (!graph || !((GraphInput) input).isCurrentMessageReference())
keyType = wrapper.value;
if (2 != input.readFieldNumber(schema))
throw new ProtostuffException("Corrupt input.");
Object valueType = input.mergeObject(wrapper, strategy.CLASS_SCHEMA);
if (!graph || !((GraphInput) input).isCurrentMessageReference())
valueType = wrapper.value;
内容来源于网络,如有侵权,请联系作者删除!