hashgraph / hashgraph/pbj

BufferedData readBytes() and writeBytes() are not symmetric

Open
#77 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
44
Forks
15
Avg merge
1d 15h
Merged PRs (30d)
12

Description

`BufferedData` class contains `readBytes()` and `writeBytes()` method, which work with another `BufferedData` object. I would expect that

```java
bufferedData1.readBytes(bufferedData2);
```

should be the same as

```java
bufferedData2.writeBytes(bufferedData1);
```

but they are not. `writeBytes()` just forwards the call to the underlying byte buffer. `readBytes()` is slightly more intelligent, it checks remaining bytes, sets the limit, then write actual bytes, and finally resets the limit.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.