Package ghidra.util
Interface ByteBufferUtils
public interface ByteBufferUtils
Some utilities for manipulating a
ByteBuffer-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic booleanmaskedEquals(ByteBuffer mask, ByteBuffer a, ByteBuffer b) Checks for equality, with a mask appliedstatic ByteBufferresize(ByteBuffer buf, int capacity) Resize a write-mode bufferstatic ByteBufferupsize(ByteBuffer buf) Resize a write-mode buffer to twice its current capacity
-
Method Details
-
resize
Resize a write-mode bufferThis preserves the buffer contents
- Parameters:
buf- the buffercapacity- the new capacity, greater or equal to the buffer's limit- Returns:
- the new buffer
-
upsize
Resize a write-mode buffer to twice its current capacityThis preserves the buffer contents
- Parameters:
buf- the buffer- Returns:
- the new buffer
-
maskedEquals
Checks for equality, with a mask appliedThis considers the entire contents of both buffers without regard for position or limit. Both buffers must have equal capacities to be considered equal. The mask, if given, must have capacity equal to that of the first buffer
aor an exception is thrown.- Parameters:
mask- a buffer containing the mask, or null to match all bytes exactlya- the first bufferb- the second buffer- Returns:
- true if matches, false otherwise
- Throws:
IllegalArgumentException- ifmaskandahave unequal capacities
-