@Override public int readUInt32() throws IOException { return input.readUInt32(); }
@Override public Byte readFrom(Input input) throws IOException { return Byte.valueOf((byte) input.readUInt32()); }
@Override public Character readFrom(Input input) throws IOException { return Character.valueOf((char) input.readUInt32()); }
@Override public Byte readFrom(Input input) throws IOException { return Byte.valueOf((byte) input.readUInt32()); }
@Override public Character readFrom(Input input) throws IOException { return Character.valueOf((char) input.readUInt32()); }
@Override protected void transferCollectionId(Input input, Output output, int fieldNumber) throws IOException { output.writeUInt32(fieldNumber, input.readUInt32(), false); }
@Override protected void transferEnumId(Input input, Output output, int fieldNumber) throws IOException { output.writeUInt32(fieldNumber, input.readUInt32(), false); }
@Override protected void transferCollectionId(Input input, Output output, int fieldNumber) throws IOException { output.writeUInt32(fieldNumber, input.readUInt32(), false); }
@Override protected CollectionSchema.MessageFactory resolveCollectionFrom(Input input) throws IOException { final int id = input.readUInt32(); final CollectionSchema.MessageFactory factory = id < collections.size() ? collections.get(id) : null; if (factory == null) throw new UnknownTypeException("collection id: " + id + " (Outdated registry)"); return factory; }
@Override @SuppressWarnings("unchecked") protected <T> HasSchema<T> resolvePojoFrom(Input input, int fieldNumber) throws IOException { final int id = input.readUInt32(); final BaseHS<T> wrapper = id < pojos.size() ? (BaseHS<T>) pojos.get(id) : null; if (wrapper == null) throw new UnknownTypeException("pojo id: " + id + " (Outdated registry)"); return wrapper; }
@Override protected CollectionSchema.MessageFactory resolveCollectionFrom(Input input) throws IOException { final int id = input.readUInt32(); final RuntimeCollectionFactory factory = id < collections.size() ? collections.get(id) : null; if (factory == null) throw new UnknownTypeException("Unknown collection id: " + id); return factory; }
@Override protected void transferEnumId(Input input, Output output, int fieldNumber) throws IOException { output.writeUInt32(fieldNumber, input.readUInt32(), false); }
@Override protected EnumIO<?> resolveEnumFrom(Input input) throws IOException { final int id = input.readUInt32(); final RuntimeEnumIO reio = id < enums.size() ? enums.get(id) : null; if (reio == null) throw new UnknownTypeException("Unknown enum id: " + id); return reio.eio; }
@Override @SuppressWarnings("unchecked") protected <T> HasDelegate<T> resolveDelegateFrom(Input input) throws IOException { final int id = input.readUInt32(); final RegisteredDelegate<T> rd = id < delegates.size() ? (RegisteredDelegate<T>) delegates.get(id) : null; if (rd == null) throw new UnknownTypeException("delegate id: " + id + " (Outdated registry)"); return rd; }
@Override public void transfer(Pipe pipe, Input input, Output output, int number, boolean repeated) throws IOException { output.writeUInt32(number, input.readUInt32(), repeated); }
@Override public void transfer(Pipe pipe, Input input, Output output, int number, boolean repeated) throws IOException { output.writeUInt32(number, input.readUInt32(), repeated); }
@Override @SuppressWarnings("unchecked") protected <T> HasSchema<T> transferPojoId(Input input, Output output, int fieldNumber) throws IOException { final int id = input.readUInt32(); final BaseHS<T> wrapper = (BaseHS<T>) pojos.get(id); if (wrapper == null) throw new UnknownTypeException("pojo id: " + id + " (Outdated registry)"); output.writeUInt32(fieldNumber, id, false); return wrapper; }
@Override protected void transferArrayId(Input input, Output output, int fieldNumber, boolean mapped) throws IOException { if (mapped) input.transferByteRangeTo(output, true, fieldNumber, false); else output.writeUInt32(fieldNumber, input.readUInt32(), false); }
@Override public Singleton readFrom(Input input) throws IOException { if (0 != input.readUInt32()) throw new ProtostuffException("Corrupt input."); return Singleton.INSTANCE; }
static void transferClass(Pipe pipe, Input input, Output output, int number, Pipe.Schema<?> pipeSchema, boolean mapped, boolean array, IdStrategy strategy) throws IOException { strategy.transferClassId(input, output, number, mapped, array); if (array) { if (input.readFieldNumber(pipeSchema.wrappedSchema) != ID_ARRAY_DIMENSION) throw new ProtostuffException("Corrupt input."); output.writeUInt32(ID_ARRAY_DIMENSION, input.readUInt32(), false); } }