Refine search
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."); }
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."); }
static Object readObjectFrom(Input input, Schema<?> schema, Object owner, IdStrategy strategy) throws IOException { final int number = input.readFieldNumber(schema); if (number != ID_THROWABLE) throw new ProtostuffException("Corrupt input."); return readObjectFrom(input, schema, owner, strategy, number); }
static void transferObject(Pipe.Schema<Object> pipeSchema, Pipe pipe, Input input, Output output, IdStrategy strategy) throws IOException { final int number = input.readFieldNumber(pipeSchema.wrappedSchema); if (number != ID_POJO) throw new ProtostuffException("Corrupt input."); transferObject(pipeSchema, pipe, input, output, strategy, number); }
static void transferObject(Pipe.Schema<Object> pipeSchema, Pipe pipe, Input input, Output output, IdStrategy strategy) throws IOException { final int number = input.readFieldNumber(pipeSchema.wrappedSchema); if (number != ID_THROWABLE) throw new ProtostuffException("Corrupt input."); transferObject(pipeSchema, pipe, input, output, strategy, number); }
static Object readObjectFrom(Input input, Schema<?> schema, Object owner, IdStrategy strategy) throws IOException { final int number = input.readFieldNumber(schema); if (number != ID_POJO) throw new ProtostuffException("Corrupt input."); return readObjectFrom(input, schema, owner, strategy, number); }
static void transferObject(Pipe.Schema<Object> pipeSchema, Pipe pipe, Input input, Output output, IdStrategy strategy) throws IOException { final int number = input.readFieldNumber(pipeSchema.wrappedSchema); if (number != ID_THROWABLE) throw new ProtostuffException("Corrupt input."); transferObject(pipeSchema, pipe, input, output, strategy, number); }
static void transferObject(Pipe.Schema<Object> pipeSchema, Pipe pipe, Input input, Output output, IdStrategy strategy) throws IOException { final int number = input.readFieldNumber(pipeSchema.wrappedSchema); if (number != ID_POJO) throw new ProtostuffException("Corrupt input."); transferObject(pipeSchema, pipe, input, output, strategy, number); }
static Object readObjectFrom(Input input, Schema<?> schema, Object owner, IdStrategy strategy) throws IOException { final int number = input.readFieldNumber(schema); if (number != ID_POJO) throw new ProtostuffException("Corrupt input."); return readObjectFrom(input, schema, owner, strategy, number); }
static Object readObjectFrom(Input input, Schema<?> schema, Object owner, IdStrategy strategy) throws IOException { final int number = input.readFieldNumber(schema); if (number != ID_THROWABLE) throw new ProtostuffException("Corrupt input."); return readObjectFrom(input, schema, owner, strategy, number); }
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(); }
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(); }
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; }
@Override public void mergeFrom(Input input, Collection<V> message) throws IOException { for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) { switch (number) { case 0: return; case 1: addValueFrom(input, message); break; default: throw new ProtostuffException("The collection was incorrectly " + "serialized."); } } }
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; }
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; }
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)); }
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."); } }
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."); } }
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)); }