Java Code Examples for javax.print.attribute.PrintServiceAttributeSet#get()

The following examples show how to use javax.print.attribute.PrintServiceAttributeSet#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrintServiceLookupProvider.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 2
Source File: PrintServiceLookupProvider.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 3
Source File: UnixPrintServiceLookup.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 4
Source File: PrintServiceLookupProvider.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 5
Source File: UnixPrintServiceLookup.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 6
Source File: PrintServiceLookupProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName = defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector<PrintService> matchedServices = new Vector<>();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 7
Source File: UnixPrintServiceLookup.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 8
Source File: UnixPrintServiceLookup.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 9
Source File: UnixPrintServiceLookup.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 10
Source File: UnixPrintServiceLookup.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 11
Source File: PrintServiceLookupProvider.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 12
Source File: UnixPrintServiceLookup.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}
 
Example 13
Source File: UnixPrintServiceLookup.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
private PrintService[]
    getPrintServices(PrintServiceAttributeSet serviceSet) {

    if (serviceSet == null || serviceSet.isEmpty()) {
        return getPrintServices();
    }

    /* Typically expect that if a service attribute is specified that
     * its a printer name and there ought to be only one match.
     * Directly retrieve that service and confirm
     * that it meets the other requirements.
     * If printer name isn't mentioned then go a slow path checking
     * all printers if they meet the reqiremements.
     */
    PrintService[] services;
    PrinterName name = (PrinterName)serviceSet.get(PrinterName.class);
    PrintService defService;
    if (name != null && (defService = getDefaultPrintService()) != null) {
        /* To avoid execing a unix command  see if the client is asking
         * for the default printer by name, since we already have that
         * initialised.
         */

        PrinterName defName =
            (PrinterName)defService.getAttribute(PrinterName.class);

        if (defName != null && name.equals(defName)) {
            if (matchesAttributes(defService, serviceSet)) {
                services = new PrintService[1];
                services[0] = defService;
                return services;
            } else {
                return new PrintService[0];
            }
        } else {
            /* Its not the default service */
            PrintService service = getServiceByName(name);
            if (service != null &&
                matchesAttributes(service, serviceSet)) {
                services = new PrintService[1];
                services[0] = service;
                return services;
            } else {
                return new PrintService[0];
            }
        }
    } else {
        /* specified service attributes don't include a name.*/
        Vector matchedServices = new Vector();
        services = getPrintServices();
        for (int i = 0; i< services.length; i++) {
            if (matchesAttributes(services[i], serviceSet)) {
                matchedServices.add(services[i]);
            }
        }
        services = new PrintService[matchedServices.size()];
        for (int i = 0; i< services.length; i++) {
            services[i] = (PrintService)matchedServices.elementAt(i);
        }
        return services;
    }
}