Package wol

Class WakeUpUtil


  • public class WakeUpUtil
    extends java.lang.Object
    A class to wake up wake-on-lan enabled machines.
    Author:
    Steffen Moldaner
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.net.InetAddress DEFAULT_HOST
      The default wakeup host: 255.255.255.255 (limited broadcast address).
      static int DEFAULT_PORT
      The default wakeup port: 9
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static byte[] createWakeupFrame​(EthernetAddress ethernetAddress)
      Creates the byte representation of a wakeupframe for the given ethernet address.
      static void wakeup​(EthernetAddress ethernetAddress)
      Wakes up the machine with the provided ethernet address, using the default port and host.
      static void wakeup​(EthernetAddress[] ethernetAddresses)
      Wakes up the machines with the provided ethernet addresses, using the default port and host.
      static void wakeup​(EthernetAddress[] ethernetAddresses, java.net.InetAddress host)
      Wakes up the machines with provided ethernet address.
      static void wakeup​(EthernetAddress[] ethernetAddresses, java.net.InetAddress host, int port)
      Wakes up the machines with provided ethernet addresses.
      static void wakeup​(EthernetAddress ethernetAddress, java.net.InetAddress host)
      Wakes up the machine with the provided ethernet addresses, using the default port.
      static void wakeup​(EthernetAddress ethernetAddress, java.net.InetAddress host, int port)
      Wakes up the machines with provided ethernet address.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_HOST

        public static final java.net.InetAddress DEFAULT_HOST
        The default wakeup host: 255.255.255.255 (limited broadcast address).
      • DEFAULT_PORT

        public static final int DEFAULT_PORT
        The default wakeup port: 9
        See Also:
        Constant Field Values
    • Method Detail

      • wakeup

        public static void wakeup​(EthernetAddress ethernetAddress)
                           throws java.io.IOException
        Wakes up the machine with the provided ethernet address, using the default port and host.
        Parameters:
        ethernetAddress - the ethernet address to wake up
        Throws:
        java.io.IOException - if an I/O error occurs
        See Also:
        DEFAULT_HOST, DEFAULT_PORT
      • wakeup

        public static void wakeup​(EthernetAddress[] ethernetAddresses)
                           throws java.io.IOException
        Wakes up the machines with the provided ethernet addresses, using the default port and host.
        Parameters:
        ethernetAddresses - the ethernet addresses to wake up
        Throws:
        java.io.IOException - if an I/O error occurs
        See Also:
        DEFAULT_HOST, DEFAULT_PORT
      • wakeup

        public static void wakeup​(EthernetAddress ethernetAddress,
                                  java.net.InetAddress host)
                           throws java.io.IOException
        Wakes up the machine with the provided ethernet addresses, using the default port.
        Parameters:
        ethernetAddress - the ethernet address to wake up
        host - the host, the magic sequence will be send to
        Throws:
        java.io.IOException - if an I/O error occurs
        See Also:
        DEFAULT_PORT
      • wakeup

        public static void wakeup​(EthernetAddress[] ethernetAddresses,
                                  java.net.InetAddress host)
                           throws java.io.IOException
        Wakes up the machines with provided ethernet address. Equal to WakeUpUtil.wakeup(ethernetAddresses, host, DEFAULT_PORT);
        Parameters:
        ethernetAddresses - the ethernet addresses to wake up
        host - the host, the magic sequence will be send to
        Throws:
        java.io.IOException - if an I/O error occurs
        See Also:
        DEFAULT_PORT
      • wakeup

        public static void wakeup​(EthernetAddress ethernetAddress,
                                  java.net.InetAddress host,
                                  int port)
                           throws java.io.IOException
        Wakes up the machines with provided ethernet address. Equal to wakeup(new EthernetAddress[]{ethernetAddress}, host, port);
        Parameters:
        ethernetAddress - the ethernet address to wake up
        host - the host, the magic sequence will be send to
        port - the port number
        Throws:
        java.io.IOException - if an I/O error occurs
        See Also:
        wakeup(EthernetAddress[], InetAddress, int)
      • wakeup

        public static void wakeup​(EthernetAddress[] ethernetAddresses,
                                  java.net.InetAddress host,
                                  int port)
                           throws java.io.IOException
        Wakes up the machines with provided ethernet addresses. The magic sequences are sent to the given host and port.
        Parameters:
        ethernetAddresses - the ethernet addresses to wake up
        host - the host, the magic sequence will be send to
        port - the port number
        Throws:
        java.io.IOException - if an I/O error occurs
      • createWakeupFrame

        protected static byte[] createWakeupFrame​(EthernetAddress ethernetAddress)
        Creates the byte representation of a wakeupframe for the given ethernet address.
        Parameters:
        ethernetAddress - the ethernet address
        Returns:
        a byte representation of the wakeupframe