ByteBuffer provide two sets of methods to write data. First, write to the current position, e.g. put(byte). Second, write to a specified position, e.g. put(offset, byte). This isn't limited to bytes, there are similar methods for byte arrays, byte buffers, etc.
BufferedData is a PBJ wrapper on top of ByteBuffer. It provides methods to read data at the current position (e.g. readByte()) and at a given offset (e.g. getByte(offset)), but only methods to write data to the current position (e.g. writeByte(byte)). There are no methods to write data to a specified offset. I'd expect them to be named putByte(offset, byte) to be consistent with getByte().
As a result, there are no methods in high level write APIs like ProtoWriterTools. This class has methods to write data to the current position of a given buffer (typically, WritableSequentialData), but no methods to write to a given offset. Such missing methods wouldn't work with WritableSequentialData, since, well, it's sequential, but they can be implemented for BufferedData or similar. It may be reasonable to introduce a new interface like WritableRandomAccessData for this purpose, and let BufferedData implement it, but I'm not 100% sure about this idea.
ByteBufferprovide two sets of methods to write data. First, write to the current position, e.g.put(byte). Second, write to a specified position, e.g.put(offset, byte). This isn't limited to bytes, there are similar methods for byte arrays, byte buffers, etc.BufferedDatais a PBJ wrapper on top ofByteBuffer. It provides methods to read data at the current position (e.g.readByte()) and at a given offset (e.g.getByte(offset)), but only methods to write data to the current position (e.g.writeByte(byte)). There are no methods to write data to a specified offset. I'd expect them to be namedputByte(offset, byte)to be consistent withgetByte().As a result, there are no methods in high level write APIs like
ProtoWriterTools. This class has methods to write data to the current position of a given buffer (typically,WritableSequentialData), but no methods to write to a given offset. Such missing methods wouldn't work withWritableSequentialData, since, well, it's sequential, but they can be implemented forBufferedDataor similar. It may be reasonable to introduce a new interface likeWritableRandomAccessDatafor this purpose, and letBufferedDataimplement it, but I'm not 100% sure about this idea.