Skip to content

HDD-14788. Avoid using guava Ints/Longs to convert byte arrays#9927

Open
Russole wants to merge 2 commits intoapache:masterfrom
Russole:HDDS-14788
Open

HDD-14788. Avoid using guava Ints/Longs to convert byte arrays#9927
Russole wants to merge 2 commits intoapache:masterfrom
Russole:HDDS-14788

Conversation

@Russole
Copy link
Contributor

@Russole Russole commented Mar 15, 2026

What changes were proposed in this pull request?

  • Replace remaining Guava Ints/Longs conversions with ByteBuffer.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14788

How was this patch tested?

Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Russole for the patch.

Should we reuse IntegerCodec/LongCodec toPersistedFormat/fromPersistedFormat? If boxing is a performance concern, we may extract the implementation into new methods that take/return primitives (like ByteBuffer.putInt/getInt do).

Example:

  public byte[] toPersistedFormat(Integer object) {
    return object != null ? toByteArray(object) : null;
  }

  public byte[] toByteArray(int value) {
    return ByteBuffer.wrap(new byte[Integer.BYTES]).putInt(value).array();
  }

@adoroszlai adoroszlai requested a review from szetszwo March 15, 2026 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants