@Override public void writeTo(Output output, int number, Character value, boolean repeated) throws IOException { output.writeUInt32(number, value.charValue(), repeated); }
@Override public void writeTo(Output output, int number, Character value, boolean repeated) throws IOException { output.writeUInt32(number, value.charValue(), repeated); }
@Override public void writeTo(Output output, int number, Short value, boolean repeated) throws IOException { output.writeUInt32(number, value.shortValue(), repeated); }
@Override public void writeTo(Output output, int number, Byte value, boolean repeated) throws IOException { output.writeUInt32(number, value.byteValue(), repeated); }
@Override @SuppressWarnings("unchecked") protected <T> HasSchema<T> tryWritePojoIdTo(Output output, int fieldNumber, Class<T> clazz, boolean registered) throws IOException { final BaseHS<T> wrapper = (BaseHS<T>) pojoMapping.get(clazz); if (wrapper != null) output.writeUInt32(fieldNumber, wrapper.id, false); return wrapper; }
@Override public void writeTo(Output output, int number, Byte value, boolean repeated) throws IOException { output.writeUInt32(number, value.byteValue(), repeated); }
@Override @SuppressWarnings("unchecked") protected <T> HasDelegate<T> tryWriteDelegateIdTo(Output output, int fieldNumber, Class<T> clazz) throws IOException { final RegisteredDelegate<T> rd = (RegisteredDelegate<T>) delegateMapping.get( clazz); if (rd == null) return null; output.writeUInt32(fieldNumber, rd.id, false); return rd; }
@Override public void writeTo(Output output, int number, Short value, boolean repeated) throws IOException { output.writeUInt32(number, value.shortValue(), repeated); }
@Override public void transfer(Pipe pipe, Input input, Output output, int number, boolean repeated) throws IOException { output.writeUInt32(number, input.readUInt32(), repeated); }
@Override protected void writeMapIdTo(Output output, int fieldNumber, Class<?> clazz) throws IOException { final RegisteredMapFactory factory = mapMapping.get(clazz); if (factory == null) throw new UnknownTypeException("map: " + clazz); output.writeUInt32(fieldNumber, factory.id, false); }
@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 protected void writeEnumIdTo(Output output, int fieldNumber, Class<?> clazz) throws IOException { int id; RuntimeEnumIO reio = getRuntimeEnumIO(clazz); // wait till everything is completely set while (0 == (id = reio.id)) LockSupport.parkNanos(1); output.writeUInt32(fieldNumber, id, false); }
@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 writeTo(Output output, Bat message) throws IOException { output.writeUInt32(1, message.id, false); }
@Override @SuppressWarnings("unchecked") protected <T> HasSchema<T> writePojoIdTo(Output output, int fieldNumber, Class<T> clazz) throws IOException { final BaseHS<T> wrapper = (BaseHS<T>) pojoMapping.get(clazz); if (wrapper == null) throw new UnknownTypeException("pojo: " + clazz); output.writeUInt32(fieldNumber, wrapper.id, false); return wrapper; }
@Override protected void transferCollectionId(Input input, Output output, int fieldNumber) throws IOException { output.writeUInt32(fieldNumber, input.readUInt32(), false); }
@Override @SuppressWarnings("unchecked") protected <T> Schema<T> writeMessageIdTo(Output output, int fieldNumber, Message<T> message) throws IOException { final BaseHS<T> wrapper = (BaseHS<T>) pojoMapping.get(message.getClass()); if (wrapper == null) throw new UnknownTypeException("pojo: " + message.getClass()); output.writeUInt32(fieldNumber, wrapper.id, false); // TODO allow the wrapper to return an override schema? return message.cachedSchema(); }
@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); }