Class AbstractPrinter

java.lang.Object
oshi.hardware.common.AbstractPrinter
All Implemented Interfaces:
Printer
Direct Known Subclasses:
CupsPrinter, WindowsPrinter

@Immutable public abstract class AbstractPrinter extends Object implements Printer
Abstract base class for Printer implementations.
  • Constructor Details

    • AbstractPrinter

      protected AbstractPrinter(String name, String driverName, String description, Printer.PrinterStatus status, String statusReason, boolean isDefault, boolean isLocal, String portName)
      Creates an AbstractPrinter with the given parameters.
      Parameters:
      name - the printer name
      driverName - the driver name
      description - the description
      status - the printer status
      statusReason - the status reason
      isDefault - whether this is the default printer
      isLocal - whether this is a local printer
      portName - the port name
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Printer
      Retrieves the name of the printer.
      Specified by:
      getName in interface Printer
      Returns:
      The printer name.
    • getDriverName

      public String getDriverName()
      Description copied from interface: Printer
      Retrieves the driver name or make/model of the printer.
      Specified by:
      getDriverName in interface Printer
      Returns:
      The driver or model name.
    • getDescription

      public String getDescription()
      Description copied from interface: Printer
      Retrieves the user-friendly description of the printer.
      Specified by:
      getDescription in interface Printer
      Returns:
      The printer description.
    • getStatus

      public Printer.PrinterStatus getStatus()
      Description copied from interface: Printer
      Retrieves the current status of the printer.
      Specified by:
      getStatus in interface Printer
      Returns:
      The printer status.
    • getStatusReason

      public String getStatusReason()
      Description copied from interface: Printer
      Retrieves the reason for the current printer status, if available.
      Specified by:
      getStatusReason in interface Printer
      Returns:
      A string describing the status reason (e.g., "Paper Jam", "media-empty"), or empty string if none.
    • isDefault

      public boolean isDefault()
      Description copied from interface: Printer
      Indicates whether this is the default printer.
      Specified by:
      isDefault in interface Printer
      Returns:
      true if this is the default printer, false otherwise.
    • isLocal

      public boolean isLocal()
      Description copied from interface: Printer
      Indicates whether this is a local printer (as opposed to a network printer).
      Specified by:
      isLocal in interface Printer
      Returns:
      true if this is a local printer, false if it is a network printer.
    • getPortName

      public String getPortName()
      Description copied from interface: Printer
      Retrieves the port name or device URI of the printer.
      Specified by:
      getPortName in interface Printer
      Returns:
      The port name or URI.
    • toString

      public String toString()
      Overrides:
      toString in class Object