![JAR search and dependency download from the Maven repository](/logo.png)
org.infinispan.server.resp.commands.pubsub.KeyChannelUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infinispan-server-resp Show documentation
Show all versions of infinispan-server-resp Show documentation
Infinispan Resp Protocol Server
package org.infinispan.server.resp.commands.pubsub;
import java.util.Arrays;
public final class KeyChannelUtils {
private KeyChannelUtils() {
}
// Random bytes to keep listener keys separate from others. Means `resp|`.
public static final byte[] PREFIX_CHANNEL_BYTES = new byte[]{114, 101, 115, 112, 124};
public static byte[] keyToChannel(byte[] keyBytes) {
byte[] result = new byte[keyBytes.length + PREFIX_CHANNEL_BYTES.length];
System.arraycopy(PREFIX_CHANNEL_BYTES, 0, result, 0, PREFIX_CHANNEL_BYTES.length);
System.arraycopy(keyBytes, 0, result, PREFIX_CHANNEL_BYTES.length, keyBytes.length);
return result;
}
public static byte[] channelToKey(byte[] channelBytes) {
return Arrays.copyOfRange(channelBytes, PREFIX_CHANNEL_BYTES.length, channelBytes.length);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy