Enum GearmanPacketMagic

    • Method Detail

      • values

        public static GearmanPacketMagic[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (GearmanPacketMagic c : GearmanPacketMagic.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static GearmanPacketMagic valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • toBytes

        public byte[] toBytes()
        Returns:
        the PacketMagic bytes
      • fromBytes

        public static GearmanPacketMagic fromBytes​(byte[] bytes)
        "\0REQ" == [ 00 52 45 51 ] == 5391697 "\0RES" == [ 00 52 45 53 ] == 5391699
        Parameters:
        bytes - array of bytes containing magic code for a packet
        Throws:
        GearmanPacketMagic.BadMagicException - if byte array is not 4 bytes long