本文整理了Java中io.protostuff.Schema.mergeFrom()
方法的一些代码示例,展示了Schema.mergeFrom()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Schema.mergeFrom()
方法的具体详情如下:
包路径:io.protostuff.Schema
类名称:Schema
方法名:mergeFrom
[英]Deserializes a message/object from the Input.
[中]从输入中反序列化消息/对象。
代码示例来源:origin: protostuff/protostuff
@Override
public void mergeFrom(Input input, T message) throws IOException
{
schema.mergeFrom(input, message);
}
代码示例来源:origin: protostuff/protostuff
/**
* Merges the {@code message} from the {@link InputStream} using the given {@code schema}.
*/
static <T> void mergeFrom(InputStream in, T message, Schema<T> schema,
boolean decodeNestedMessageAsGroup) throws IOException
{
final CodedInput input = new CodedInput(in, decodeNestedMessageAsGroup);
schema.mergeFrom(input, message);
input.checkLastTagWas(0);
}
代码示例来源:origin: protostuff/protostuff
@Override
public void mergeFrom(Input input, final Object message) throws IOException
{
final Schema<Object> schema = lastSchema;
// merge using this input.
schema.mergeFrom(this, message);
if (!schema.isInitialized(message))
throw new UninitializedMessageException(message, schema);
// restore
lastSchema = schema;
}
代码示例来源:origin: protostuff/protostuff
@Override
public void mergeFrom(Input input, final Object message) throws IOException
{
final Schema<Object> schema = lastSchema;
// merge using this input.
schema.mergeFrom(this, message);
if (!schema.isInitialized(message))
throw new UninitializedMessageException(message, schema);
// restore
lastSchema = schema;
}
代码示例来源:origin: protostuff/protostuff
/**
* Merges the {@code message} from the JsonParser using the given {@code schema}.
*/
public static <T> void mergeFrom(MessageUnpacker unpacker, T message, Schema<T> schema, boolean numeric)
throws IOException
{
MsgpackParser parser = new MsgpackParser(unpacker, numeric);
schema.mergeFrom(new MsgpackInput(parser), message);
}
代码示例来源:origin: protostuff/protostuff
/**
* Merges the {@code message} from the {@link InputStream} with the supplied {@code buf} to use.
*/
static <T> void mergeFrom(InputStream in, byte[] buf, T message, Schema<T> schema,
boolean decodeNestedMessageAsGroup) throws IOException
{
final CodedInput input = new CodedInput(in, buf, decodeNestedMessageAsGroup);
schema.mergeFrom(input, message);
input.checkLastTagWas(0);
}
代码示例来源:origin: protostuff/protostuff
/**
* Merges the {@code message} from the {@link InputStream} using the given {@code schema}.
*/
public static <T> void mergeFrom(InputStream in, T message, Schema<T> schema)
throws IOException
{
final CodedInput input = new CodedInput(in, true);
final GraphCodedInput graphInput = new GraphCodedInput(input);
schema.mergeFrom(graphInput, message);
input.checkLastTagWas(0);
}
代码示例来源:origin: protostuff/protostuff
/**
* Merges the {@code message} from the {@link InputStream} using the given {@code schema}.
* <p>
* The {@code buffer}'s internal byte array will be used for reading the message.
*/
public static <T> void mergeFrom(InputStream in, T message, Schema<T> schema,
LinkedBuffer buffer) throws IOException
{
final CodedInput input = new CodedInput(in, buffer.buffer, true);
final GraphCodedInput graphInput = new GraphCodedInput(input);
schema.mergeFrom(graphInput, message);
input.checkLastTagWas(0);
}
代码示例来源:origin: protostuff/protostuff
private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException
{
if (value == null)
value = schema.newMessage();
schema.mergeFrom(this, value);
if (!schema.isInitialized(value))
throw new UninitializedMessageException(value, schema);
// handling is in #readFieldNumber
checkLastTagWas(0);
return value;
}
代码示例来源:origin: protostuff/protostuff
private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException
{
if (value == null)
value = schema.newMessage();
schema.mergeFrom(this, value);
if (!schema.isInitialized(value))
throw new UninitializedMessageException(value, schema);
// handling is in #readFieldNumber
checkLastTagWas(0);
return value;
}
代码示例来源:origin: fengjiachun/Jupiter
private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException {
if (value == null) {
value = schema.newMessage();
}
schema.mergeFrom(this, value);
if (!schema.isInitialized(value)) {
throw new UninitializedMessageException(value, schema);
}
// handling is in #readFieldNumber
checkLastTagWas(0);
return value;
}
代码示例来源:origin: fengjiachun/Jupiter
private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException {
if (value == null) {
value = schema.newMessage();
}
schema.mergeFrom(this, value);
if (!schema.isInitialized(value)) {
throw new UninitializedMessageException(value, schema);
}
// handling is in #readFieldNumber
checkLastTagWas(0);
return value;
}
代码示例来源:origin: fengjiachun/Jupiter
private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException {
if (value == null) {
value = schema.newMessage();
}
schema.mergeFrom(this, value);
if (!schema.isInitialized(value)) {
throw new UninitializedMessageException(value, schema);
}
// handling is in #readFieldNumber
checkLastTagWas(0);
return value;
}
代码示例来源:origin: fengjiachun/Jupiter
private <T> T mergeObjectEncodedAsGroup(T value, final Schema<T> schema) throws IOException {
if (value == null) {
value = schema.newMessage();
}
schema.mergeFrom(this, value);
if (!schema.isInitialized(value)) {
throw new UninitializedMessageException(value, schema);
}
// handling is in #readFieldNumber
checkLastTagWas(0);
return value;
}
代码示例来源:origin: protostuff/protostuff
@Override
public <T> T mergeObject(T value, Schema<T> schema) throws IOException
{
if (value == null)
{
value = schema.newMessage();
}
MsgpackParser innerParser = new MsgpackParser(this.parser);
MsgpackParser thisParser = use(innerParser);
schema.mergeFrom(this, value);
use(thisParser);
return value;
}
代码示例来源:origin: protostuff/protostuff
private void deserTest(Message origMsg,
Schema sch,
ByteBuffer buf) throws IOException
{
ByteBufferInput input = new ByteBufferInput(buf, true);
Object newM = sch.newMessage();
sch.mergeFrom(input, newM);
assertEquals(origMsg, newM);
}
代码示例来源:origin: protostuff/protostuff
@Override
public <T extends Message<T>> void mergeFrom(byte[] data, T message) throws IOException
{
final CodedInput input = new CodedInput(data, 0, data.length, true);
message.cachedSchema().mergeFrom(input, message);
input.checkLastTagWas(0);
}
代码示例来源:origin: protostuff/protostuff
@Override
public <T extends Message<T>> void mergeFrom(byte[] data, T message) throws IOException
{
final CodedInput input = new CodedInput(data, 0, data.length, false);
message.cachedSchema().mergeFrom(input, message);
input.checkLastTagWas(0);
}
代码示例来源:origin: protostuff/protostuff
private void deserTest(Message origMsg,
Schema sch,
ByteBuffer buf) throws IOException
{
ByteBufferInput input = new ByteBufferInput(buf, false);
Object newM = sch.newMessage();
sch.mergeFrom(input, newM);
assertEquals(origMsg, newM);
}
代码示例来源:origin: protostuff/protostuff
@Override
protected <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema)
throws IOException
{
final CodedInput input = new CodedInput(data, offset, length, false);
schema.mergeFrom(input, message);
input.checkLastTagWas(0);
assertTrue(input.isAtEnd());
}
内容来源于网络,如有侵权,请联系作者删除!