本文整理汇总了Java中io.protostuff.ProtostuffException类的典型用法代码示例。如果您正苦于以下问题:Java ProtostuffException类的具体用法?Java ProtostuffException怎么用?Java ProtostuffException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProtostuffException类属于io.protostuff包,在下文中一共展示了ProtostuffException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newArrayWrapper
import io.protostuff.ProtostuffException; //导入依赖的package包/类
static ArrayWrapper newArrayWrapper(Input input, Schema<?> schema,
boolean mapped, IdStrategy strategy) throws IOException
{
final Class<?> componentType = strategy.resolveArrayComponentTypeFrom(
input, mapped);
if (input.readFieldNumber(schema) != ID_ARRAY_LEN)
throw new ProtostuffException("Corrupt input.");
final int len = input.readUInt32();
if (input.readFieldNumber(schema) != ID_ARRAY_DIMENSION)
throw new ProtostuffException("Corrupt input.");
final int dimensions = input.readUInt32();
if (dimensions == 1)
return new ArrayWrapper(Array.newInstance(componentType, len));
final int[] arg = new int[dimensions];
arg[0] = len;
return new ArrayWrapper(Array.newInstance(componentType, arg));
}
示例2: transferArray
import io.protostuff.ProtostuffException; //导入依赖的package包/类
static void transferArray(Pipe pipe, Input input, Output output, int number,
Pipe.Schema<?> pipeSchema, boolean mapped, IdStrategy strategy) throws IOException
{
strategy.transferArrayId(input, output, number, mapped);
if (input.readFieldNumber(pipeSchema.wrappedSchema) != ID_ARRAY_LEN)
throw new ProtostuffException("Corrupt input.");
output.writeUInt32(ID_ARRAY_LEN, input.readUInt32(), false);
if (input.readFieldNumber(pipeSchema.wrappedSchema) != ID_ARRAY_DIMENSION)
throw new ProtostuffException("Corrupt input.");
output.writeUInt32(ID_ARRAY_DIMENSION, input.readUInt32(), false);
if (output instanceof StatefulOutput)
{
// update using the derived schema.
((StatefulOutput) output).updateLast(strategy.ARRAY_PIPE_SCHEMA, pipeSchema);
}
Pipe.transferDirect(strategy.ARRAY_PIPE_SCHEMA, pipe, input, output);
}
示例3: getArrayClass
import io.protostuff.ProtostuffException; //导入依赖的package包/类
static Class<?> getArrayClass(Input input, Schema<?> schema,
final Class<?> componentType) throws IOException
{
if (input.readFieldNumber(schema) != ID_ARRAY_DIMENSION)
throw new ProtostuffException("Corrupt input.");
final int dimensions = input.readUInt32();
// TODO is there another way (reflection) to obtain an array class?
if (dimensions == 1)
return Array.newInstance(componentType, 0).getClass();
final int[] arg = new int[dimensions];
arg[0] = 0;
return Array.newInstance(componentType, arg).getClass();
}
示例4: readObjectFrom
import io.protostuff.ProtostuffException; //导入依赖的package包/类
static Object readObjectFrom(Input input, Schema<?> schema, Object owner,
IdStrategy strategy) throws IOException
{
if (ID_ENUM != input.readFieldNumber(schema))
throw new ProtostuffException("Corrupt input.");
final EnumIO<?> eio = strategy.resolveEnumFrom(input);
if (ID_ENUM_VALUE != input.readFieldNumber(schema))
throw new ProtostuffException("Corrupt input.");
final Object value = eio.readFrom(input);
if (input instanceof GraphInput)
{
// update the actual reference.
((GraphInput) input).updateLast(value, owner);
}
if (0 != input.readFieldNumber(schema))
throw new ProtostuffException("Corrupt input.");
return value;
}
示例5: transferObject
import io.protostuff.ProtostuffException; //导入依赖的package包/类
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);
if (0 != input.readFieldNumber(pipeSchema.wrappedSchema))
throw new ProtostuffException("Corrupt input.");
}
示例6: transferObject
import io.protostuff.ProtostuffException; //导入依赖的package包/类
static void transferObject(Pipe.Schema<Object> pipeSchema, Pipe pipe,
Input input, Output output, IdStrategy strategy) throws IOException
{
final int number = input.readFieldNumber(pipeSchema.wrappedSchema);
switch (number)
{
case ID_ARRAY:
ObjectSchema.transferArray(pipe, input, output, number, pipeSchema,
false, strategy);
return;
case ID_ARRAY_MAPPED:
ObjectSchema.transferArray(pipe, input, output, number, pipeSchema,
true, strategy);
return;
default:
throw new ProtostuffException("Corrupt input.");
}
}
示例7: transferPojoId
import io.protostuff.ProtostuffException; //导入依赖的package包/类
@Override
protected <T> HasSchema<T> transferPojoId(Input input, Output output,
int fieldNumber) throws IOException
{
final String className = input.readString();
final HasSchema<T> wrapper = getSchemaWrapper(className,
RuntimeEnv.AUTO_LOAD_POLYMORPHIC_CLASSES);
if (wrapper == null)
{
throw new ProtostuffException("polymorphic pojo not registered: "
+ className);
}
output.writeString(fieldNumber, className, false);
return wrapper;
}
示例8: transfer
import io.protostuff.ProtostuffException; //导入依赖的package包/类
@Override
public void transfer(Pipe pipe, Input input, Output output)
throws IOException
{
final int first = input.readFieldNumber(DerivativeSchema.this);
if (first != ID_POJO)
throw new ProtostuffException("order not preserved.");
final Pipe.Schema<Object> pipeSchema = strategy.transferPojoId(
input, output, ID_POJO).getPipeSchema();
if (output instanceof StatefulOutput)
{
// update using the derived schema.
((StatefulOutput) output).updateLast(pipeSchema, this);
}
Pipe.transferDirect(pipeSchema, pipe, input, output);
}
示例9: readPrimitiveFrom
import io.protostuff.ProtostuffException; //导入依赖的package包/类
protected Object readPrimitiveFrom(Input input, Object owner, int len)
throws IOException
{
boolean[] array = new boolean[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.readBool();
}
if (0 != input.readFieldNumber(this))
throw new ProtostuffException("Corrupt input.");
return array;
}
示例10: transferObject
import io.protostuff.ProtostuffException; //导入依赖的package包/类
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.");
}
示例11: transferPojoId
import io.protostuff.ProtostuffException; //导入依赖的package包/类
@Override
protected <T> HasSchema<T> transferPojoId(Input input, Output output,
int fieldNumber) throws IOException
{
final String className = input.readString();
final HasSchema<T> wrapper = getSchemaWrapper(className,
0 != (AUTO_LOAD_POLYMORPHIC_CLASSES & flags));
if (wrapper == null)
{
throw new ProtostuffException("polymorphic pojo not registered: "
+ className);
}
output.writeString(fieldNumber, className, false);
return wrapper;
}
示例12: readCheckedCollectionFrom
import io.protostuff.ProtostuffException; //导入依赖的package包/类
private static Object readCheckedCollectionFrom(Input input,
Schema<?> schema, Object owner, IdStrategy strategy, boolean graph,
Object collection, boolean ss, boolean list) throws IOException
{
if (graph)
{
// update the actual reference.
((GraphInput) input).updateLast(collection, owner);
}
final Wrapper wrapper = new Wrapper();
Object c = input.mergeObject(wrapper,
strategy.POLYMORPHIC_COLLECTION_SCHEMA);
if (!graph || !((GraphInput) input).isCurrentMessageReference())
c = wrapper.value;
if (1 != input.readFieldNumber(schema))
throw new ProtostuffException("Corrupt input.");
Object type = input.mergeObject(wrapper, strategy.CLASS_SCHEMA);
if (!graph || !((GraphInput) input).isCurrentMessageReference())
type = wrapper.value;
try
{
fCheckedCollection_c.set(collection, c);
fCheckedCollection_type.set(collection, type);
if (ss)
fCheckedSortedSet_ss.set(collection, c);
if (list)
fCheckedList_list.set(collection, c);
}
catch (IllegalArgumentException | IllegalAccessException e)
{
throw new RuntimeException(e);
}
return collection;
}
示例13: transferObject
import io.protostuff.ProtostuffException; //导入依赖的package包/类
static void transferObject(Pipe.Schema<Object> pipeSchema, Pipe pipe,
Input input, Output output, IdStrategy strategy,
Delegate<?> delegate) throws IOException
{
if (ID_ARRAY_LEN != input.readFieldNumber(pipeSchema.wrappedSchema))
throw new ProtostuffException("Corrupt input.");
final int len = input.readUInt32();
// write it back
output.writeUInt32(ID_ARRAY_LEN, len, false);
for (int i = 0, nullCount = 0; i < len;)
{
switch (input.readFieldNumber(pipeSchema.wrappedSchema))
{
case ID_ARRAY_DATA:
i++;
delegate.transfer(pipe, input, output, ID_ARRAY_DATA, true);
break;
case ID_ARRAY_NULLCOUNT:
nullCount = input.readUInt32();
i += nullCount;
output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
break;
default:
throw new ProtostuffException("Corrupt input.");
}
}
if (0 != input.readFieldNumber(pipeSchema.wrappedSchema))
throw new ProtostuffException("Corrupt input.");
}
示例14: readFrom
import io.protostuff.ProtostuffException; //导入依赖的package包/类
@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.readUInt32();
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;
}
示例15: transfer
import io.protostuff.ProtostuffException; //导入依赖的package包/类
@Override
protected void transfer(Pipe pipe, Input input, Output output)
throws IOException
{
if (ID_ARRAY_LEN != input
.readFieldNumber(pipeSchema.wrappedSchema))
throw new ProtostuffException("Corrupt input.");
final int len = input.readUInt32();
// write it back
output.writeUInt32(ID_ARRAY_LEN, len, false);
for (int i = 0, nullCount = 0; i < len;)
{
switch (input.readFieldNumber(pipeSchema.wrappedSchema))
{
case ID_ARRAY_DATA:
i++;
EnumIO.transfer(pipe, input, output, ID_ARRAY_DATA, true);
break;
case ID_ARRAY_NULLCOUNT:
nullCount = input.readUInt32();
i += nullCount;
output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
break;
default:
throw new ProtostuffException("Corrupt input.");
}
}
if (0 != input.readFieldNumber(pipeSchema.wrappedSchema))
throw new ProtostuffException("Corrupt input.");
}