Class CupsPrinter

java.lang.Object
oshi.hardware.common.AbstractPrinter
oshi.hardware.common.platform.unix.CupsPrinter
All Implemented Interfaces:
Printer
Direct Known Subclasses:
LpstatPrinter

@Immutable public abstract class CupsPrinter extends AbstractPrinter
CUPS-based printer implementation with shared lpstat fallback logic. Subclasses provide native CUPS access via JNA or FFM.
  • Constructor Details

    • CupsPrinter

      protected CupsPrinter(String name, String driverName, String description, Printer.PrinterStatus status, String statusReason, boolean isDefault, boolean isLocal, String portName)
      Creates a CupsPrinter 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

    • getPrintersFromLpstat

      protected static List<Printer> getPrintersFromLpstat(CupsPrinter.PrinterFactory factory)
      Gets printers by parsing lpstat command output. Used as a fallback when libcups is unavailable.
      Parameters:
      factory - function to create concrete printer instances
      Returns:
      list of printers