Skip to content

Need more random access related methods #940

Description

@artemananiev

This is a follow-up to #790. That ticket (and related PRs) added some methods to BufferedData, but they are not enough for real world scenarios to write data to RandomAccessData (in particular, to write objects to files in MerkleDb using mapped byte buffers / memory segments).

A few methods to add:

  • Bytes.putTo(RandomAccessData, offset) - to write Bytes at a given offset, similar to existing Bytes.writeTo(WritableSequentialData)
  • BufferedData.putTo(RandomAccessData, offset) - similar to Bytes
  • RandomAccessData.putBytes(offset, ByteBuffer) - similar to existing RandomAccessData.putBytes(offset, byte[]), needed to implement the above
  • ProtoWriterTools.putTag(RandomAccessData, offset, field) - similar to existing ProtoWriterTools.writeTag(WritableSequentialData), not strictly needed, but handy

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ImprovementCode changes driven by non business requirements.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions