Package zmq.util

Class Utils

java.lang.Object
zmq.util.Utils

public class Utils extends Object
  • Field Details

  • Constructor Details

    • Utils

      private Utils()
  • Method Details

    • randomInt

      public static int randomInt()
    • randomInt

      public static int randomInt(int bound)
    • randomBytes

      public static byte[] randomBytes(int length)
    • unhash

      public static String unhash(int port)
      Finds a string whose hashcode is the number in input.
      Parameters:
      port - the port to find String hashcode-equivalent of. Has to be positive or 0.
      Returns:
      a String whose hashcode is the number in input.
    • unhash

      private static StringBuilder unhash(StringBuilder builder, int port, char boundary)
    • findOpenPort

      public static int findOpenPort() throws IOException
      Throws:
      IOException
    • unblockSocket

      public static void unblockSocket(SelectableChannel... channels) throws IOException
      Throws:
      IOException
    • realloc

      public static <T> T[] realloc(Class<T> klass, T[] src, int size, boolean ended)
    • bytes

      public static byte[] bytes(ByteBuffer buf)
    • realloc

      public static byte[] realloc(byte[] src, int size)
    • delete

      public static boolean delete(File path)
    • getPeerIpAddress

      public static Address getPeerIpAddress(SocketChannel fd)
    • dump

      public static String dump(ByteBuffer buffer, int pos, int limit)
    • checkArgument

      public static void checkArgument(boolean expression, String errorMessage)
    • checkArgument

      public static void checkArgument(boolean expression, Supplier<String> errorMessage)