Class PrinterDevice

  • All Implemented Interfaces:
    Device

    public class PrinterDevice
    extends java.lang.Object
    implements Device
    Printer device class of type DocFlavor.INPUT_STREAM.AUTOSENSE This class can be used when sending a file to a printer.
    Version:
    3 jul 2008
    Author:
    Joel HÃ¥kansson
    • Constructor Summary

      Constructors 
      Constructor Description
      PrinterDevice​(java.lang.String deviceName, boolean fuzzyLookup)
      Create a device with the provided name.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.print.PrintService[] getDevices()
      List available devices
      void transmit​(java.io.File file)
      Transmit a file to the device
      • Methods inherited from class java.lang.Object

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

      • PrinterDevice

        public PrinterDevice​(java.lang.String deviceName,
                             boolean fuzzyLookup)
        Create a device with the provided name.
        Parameters:
        deviceName - the name of the device
        fuzzyLookup - If true, the returned device is any device whose name contains the supplied deviceName. If false, the returned device name equals the supplied deviceName.
        Throws:
        java.lang.IllegalArgumentException - if no device is found.
    • Method Detail

      • getDevices

        public static javax.print.PrintService[] getDevices()
        List available devices
        Returns:
        returns a list of available devices that accepts DocFlavor.INPUT_STREAM.AUTOSENSE
      • transmit

        public void transmit​(java.io.File file)
                      throws javax.print.PrintException
        Transmit a file to the device
        Specified by:
        transmit in interface Device
        Parameters:
        file - the file to transmit
        Throws:
        java.io.FileNotFoundException
        javax.print.PrintException