mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-25 09:18:02 +01:00
37 lines
716 B
Java
37 lines
716 B
Java
package org.whispersystems.dispatch.util;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.IOException;
|
|
|
|
public class Util {
|
|
|
|
public static byte[] combine(byte[]... elements) {
|
|
try {
|
|
int sum = 0;
|
|
|
|
for (byte[] element : elements) {
|
|
sum += element.length;
|
|
}
|
|
|
|
ByteArrayOutputStream baos = new ByteArrayOutputStream(sum);
|
|
|
|
for (byte[] element : elements) {
|
|
baos.write(element);
|
|
}
|
|
|
|
return baos.toByteArray();
|
|
} catch (IOException e) {
|
|
throw new AssertionError(e);
|
|
}
|
|
}
|
|
|
|
|
|
public static void sleep(long millis) {
|
|
try {
|
|
Thread.sleep(millis);
|
|
} catch (InterruptedException e) {
|
|
throw new AssertionError(e);
|
|
}
|
|
}
|
|
}
|