Package io.camunda.zeebe.util.buffer
Class BufferUtil
java.lang.Object
io.camunda.zeebe.util.buffer.BufferUtil
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]bufferAsArray(org.agrona.DirectBuffer buffer) static StringbufferAsHexString(org.agrona.DirectBuffer buffer) static StringbufferAsString(org.agrona.DirectBuffer buffer) static StringbufferAsString(org.agrona.DirectBuffer buffer, int offset, int length) static StringbytesAsHexString(byte[] bytes) static StringbytesAsHexString(byte[] bytes, int wrap) static org.agrona.DirectBuffercloneBuffer(org.agrona.DirectBuffer src) Creates a new instance of the src buffer class and copies the underlying bytes.static org.agrona.DirectBuffercloneBuffer(org.agrona.DirectBuffer src, int offset, int length) Creates a new instance of the src buffer class and copies the underlying bytes.static booleancontentsEqual(org.agrona.DirectBuffer buffer1, org.agrona.DirectBuffer buffer2) byte-by-byte comparison of two buffersstatic org.agrona.DirectBuffercreateCopy(BufferWriter writer) static booleanequals(org.agrona.DirectBuffer buffer1, org.agrona.DirectBuffer buffer2) Compare the given buffers.static booleanstartsWith(byte[] prefix, int prefixOffset, int prefixLength, byte[] content, int contentOffset, int contentLength) Performs byte wise comparison of a given byte array and a prefix.static org.agrona.MutableDirectBufferwrapArray(byte[] array) static org.agrona.DirectBufferwrapString(String argument)
-
Field Details
-
NO_WRAP
public static final int NO_WRAP- See Also:
-
-
Method Details
-
bufferAsString
-
bufferAsString
-
wrapString
-
equals
public static boolean equals(org.agrona.DirectBuffer buffer1, org.agrona.DirectBuffer buffer2) Compare the given buffers. -
contentsEqual
public static boolean contentsEqual(org.agrona.DirectBuffer buffer1, org.agrona.DirectBuffer buffer2) byte-by-byte comparison of two buffers -
createCopy
-
cloneBuffer
public static org.agrona.DirectBuffer cloneBuffer(org.agrona.DirectBuffer src) Creates a new instance of the src buffer class and copies the underlying bytes.- Parameters:
src- the buffer to copy from- Returns:
- the new buffer instance
-
cloneBuffer
public static org.agrona.DirectBuffer cloneBuffer(org.agrona.DirectBuffer src, int offset, int length) Creates a new instance of the src buffer class and copies the underlying bytes.- Parameters:
src- the buffer to copy fromoffset- the offset to start in the src bufferlength- the number of bytes to clone- Returns:
- the new buffer instance
-
bufferAsHexString
-
bytesAsHexString
-
bytesAsHexString
-
bufferAsArray
public static byte[] bufferAsArray(org.agrona.DirectBuffer buffer) - Returns:
- a new array that is a copy of the buffer's contents
-
wrapArray
public static org.agrona.MutableDirectBuffer wrapArray(byte[] array) -
startsWith
public static boolean startsWith(byte[] prefix, int prefixOffset, int prefixLength, byte[] content, int contentOffset, int contentLength) Performs byte wise comparison of a given byte array and a prefix.- Parameters:
prefix- the prefix to look forprefixOffset- offset in the prefix arrayprefixLength- length of the prefixcontent- the array to check againstcontentOffset- the offset in the content arraycontentLength- the length of the content to check- Returns:
- true if array starts with the all bytes contained in prefix
-