@Override public void writeMarshallable(BytesOut bytes) { bytes.writeLong(ts); bytes.write(filler); } }
@Override @SuppressWarnings({"rawtypes", "No way to provide generic type and override WriteBytesMarshallable."}) public void writeMarshallable(@NotNull final BytesOut bytes) { bytes.writeLong(this.logEntry.getSessionId()); bytes.writeInt(this.logEntry.getLogLevel()); bytes.writeInt(this.logEntry.getSecurityLevel()); bytes.writeLong(this.logEntry.getPosixTimestamp()); // Limit size of string messages. final int messageSize = Math.min(this.logEntry.getMessage().length(), this.maxMessageSize); // Write message length bytes.writeStopBit((long) messageSize); // Write message bytes. bytes.write(this.logEntry.getMessage(), 0, messageSize); } }
@Override public void writeMarshallable(BytesOut bytes) { BytesStore bytesStore = bytesStore(); if (bytesStore == null) { long capacity = getCapacity(); bytes.writeLong(capacity); bytes.writeLong(0); bytes.writeSkip(capacity * 8); } else { bytes.write(bytesStore, offset, 2 * 8 + length * 8); } }
BytesStore bs = (BytesStore) obj; writeStopBit(bs.readRemaining()); write(bs); return;
@Override protected void getValue(Object o, @NotNull BytesOut write) throws IllegalAccessException { @NotNull BytesStore bytes = (BytesStore) field.get(o); if (bytes == null) { write.writeStopBit(-1); return; } long offset = bytes.readPosition(); long length = bytes.readRemaining(); write.writeStopBit(length); write.write(bytes, offset, length); }
default void readWithLength(long length, @NotNull BytesOut<Underlying> bytesOut) throws BufferUnderflowException, IORuntimeException { if (length > readRemaining()) throw new BufferUnderflowException(); long limit0 = readLimit(); long limit = readPosition() + length; boolean lenient = lenient(); try { lenient(true); readLimit(limit); bytesOut.write(this); } finally { readLimit(limit0); readPosition(limit); lenient(lenient); } }