Java 类javax.print.attribute.standard.QueuedJobCount 实例源码

项目:OpenJSharp    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountAIX() {
    // On AIX there should not be a blank after '-a'.
    String command = "/usr/bin/lpstat -a" + printer;
    String results[]=  UnixPrintServiceLookup.execCmd(command);

    // Remove headers and bogus entries added by remote printers.
    results = filterPrinterNamesAIX(results);

    int qlen = 0;
    if (results != null && results.length > 0){
        for (int i = 0; i < results.length; i++) {
            if (results[i].contains("QUEUED")){
                qlen ++;
            }
        }
    }
    return new QueuedJobCount(qlen);
}
项目:OpenJSharp    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:jdk8u-jdk    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountAIX() {
    // On AIX there should not be a blank after '-a'.
    String command = "/usr/bin/lpstat -a" + printer;
    String results[]=  UnixPrintServiceLookup.execCmd(command);

    // Remove headers and bogus entries added by remote printers.
    results = filterPrinterNamesAIX(results);

    int qlen = 0;
    if (results != null && results.length > 0){
        for (int i = 0; i < results.length; i++) {
            if (results[i].contains("QUEUED")){
                qlen ++;
            }
        }
    }
    return new QueuedJobCount(qlen);
}
项目:jdk8u-jdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:openjdk-jdk10    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountAIX() {
    // On AIX there should not be a blank after '-a'.
    String command = "/usr/bin/lpstat -a" + printer;
    String results[]=  PrintServiceLookupProvider.execCmd(command);

    // Remove headers and bogus entries added by remote printers.
    results = filterPrinterNamesAIX(results);

    int qlen = 0;
    if (results != null && results.length > 0){
        for (int i = 0; i < results.length; i++) {
            if (results[i].contains("QUEUED")){
                qlen ++;
            }
        }
    }
    return new QueuedJobCount(qlen);
}
项目:openjdk-jdk10    文件:UnixPrintService.java   
@SuppressWarnings("unchecked")
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:openjdk9    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountAIX() {
    // On AIX there should not be a blank after '-a'.
    String command = "/usr/bin/lpstat -a" + printer;
    String results[]=  PrintServiceLookupProvider.execCmd(command);

    // Remove headers and bogus entries added by remote printers.
    results = filterPrinterNamesAIX(results);

    int qlen = 0;
    if (results != null && results.length > 0){
        for (int i = 0; i < results.length; i++) {
            if (results[i].contains("QUEUED")){
                qlen ++;
            }
        }
    }
    return new QueuedJobCount(qlen);
}
项目:openjdk9    文件:UnixPrintService.java   
@SuppressWarnings("unchecked")
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:jdk8u_jdk    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountAIX() {
    // On AIX there should not be a blank after '-a'.
    String command = "/usr/bin/lpstat -a" + printer;
    String results[]=  UnixPrintServiceLookup.execCmd(command);

    // Remove headers and bogus entries added by remote printers.
    results = filterPrinterNamesAIX(results);

    int qlen = 0;
    if (results != null && results.length > 0){
        for (int i = 0; i < results.length; i++) {
            if (results[i].contains("QUEUED")){
                qlen ++;
            }
        }
    }
    return new QueuedJobCount(qlen);
}
项目:jdk8u_jdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountAIX() {
    // On AIX there should not be a blank after '-a'.
    String command = "/usr/bin/lpstat -a" + printer;
    String results[]=  UnixPrintServiceLookup.execCmd(command);

    // Remove headers and bogus entries added by remote printers.
    results = filterPrinterNamesAIX(results);

    int qlen = 0;
    if (results != null && results.length > 0){
        for (int i = 0; i < results.length; i++) {
            if (results[i].contains("QUEUED")){
                qlen ++;
            }
        }
    }
    return new QueuedJobCount(qlen);
}
项目:lookaside_java-1.8.0-openjdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:infobip-open-jdk-8    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountAIX() {
    // On AIX there should not be a blank after '-a'.
    String command = "/usr/bin/lpstat -a" + printer;
    String results[]=  UnixPrintServiceLookup.execCmd(command);

    // Remove headers and bogus entries added by remote printers.
    results = filterPrinterNamesAIX(results);

    int qlen = 0;
    if (results != null && results.length > 0){
        for (int i = 0; i < results.length; i++) {
            if (results[i].contains("QUEUED")){
                qlen ++;
            }
        }
    }
    return new QueuedJobCount(qlen);
}
项目:infobip-open-jdk-8    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:jdk8u-dev-jdk    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountAIX() {
    // On AIX there should not be a blank after '-a'.
    String command = "/usr/bin/lpstat -a" + printer;
    String results[]=  UnixPrintServiceLookup.execCmd(command);

    // Remove headers and bogus entries added by remote printers.
    results = filterPrinterNamesAIX(results);

    int qlen = 0;
    if (results != null && results.length > 0){
        for (int i = 0; i < results.length; i++) {
            if (results[i].contains("QUEUED")){
                qlen ++;
            }
        }
    }
    return new QueuedJobCount(qlen);
}
项目:jdk8u-dev-jdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:jdk7-jdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:openjdk-source-code-learn    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:OLD-OpenJDK8    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:openjdk-jdk7u-jdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:openjdk-icedtea7    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:OpenJSharp    文件:Win32PrintService.java   
private QueuedJobCount getQueuedJobCount() {

        int count = getJobStatus(printer, 1);
        if (count != -1) {
            return new QueuedJobCount(count);
        }
        else {
            return new QueuedJobCount(0);
        }
    }
项目:OpenJSharp    文件:Win32PrintService.java   
public <T extends PrintServiceAttribute> T
    getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }
    if (category == ColorSupported.class) {
        int caps = getPrinterCapabilities();
        if ((caps & DEVCAP_COLOR) != 0) {
            return (T)ColorSupported.SUPPORTED;
        } else {
            return (T)ColorSupported.NOT_SUPPORTED;
        }
    } else if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:OpenJSharp    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountSysV() {
    String command = "/usr/bin/lpstat -R " + printer;
    String results[]= UnixPrintServiceLookup.execCmd(command);
    int qlen = (results == null) ? 0 : results.length;

    return new QueuedJobCount(qlen);
}
项目:OpenJSharp    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountBSD() {
    if (UnixPrintServiceLookup.cmdIndex ==
        UnixPrintServiceLookup.UNINITIALIZED) {

        UnixPrintServiceLookup.cmdIndex =
            UnixPrintServiceLookup.getBSDCommandIndex();
    }

    int qlen = 0;
    String command = "/usr/sbin/lpc status " + printer
        + lpcQueueCom[UnixPrintServiceLookup.cmdIndex];
    String results[] = UnixPrintServiceLookup.execCmd(command);

    if (results != null && results.length > 0) {
        String queued;
        if (UnixPrintServiceLookup.cmdIndex ==
            UnixPrintServiceLookup.BSD_LPD_NG) {
            queued = results[0];
        } else {
            queued = results[3].trim();
            if (queued.startsWith("no")) {
                return new QueuedJobCount(0);
            } else {
                queued = queued.substring(0, queued.indexOf(' '));
            }
        }

        try {
            qlen = Integer.parseInt(queued);
        } catch (NumberFormatException e) {
        }
    }

    return new QueuedJobCount(qlen);
}
项目:OpenJSharp    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCount() {
    if (UnixPrintServiceLookup.isSysV()) {
        return getQueuedJobCountSysV();
    } else if (UnixPrintServiceLookup.isBSD()) {
        return getQueuedJobCountBSD();
    } else if (UnixPrintServiceLookup.isAIX()) {
        return getQueuedJobCountAIX();
    } else {
        return new QueuedJobCount(0);
    }
}
项目:OpenJSharp    文件:Win32PrintService.java   
@Override
public PrintServiceAttributeSet getAttributes(){
    PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
    attrs.add(getPrinterName());
    PrinterIsAcceptingJobs acptJobs = getAttribute(PrinterIsAcceptingJobs.class);
    if(acptJobs != null){
        attrs.add(acptJobs);
    }
    PrinterState prnState = getAttribute(PrinterState.class);
    if(prnState != null){
        attrs.add(prnState);
    }
    PrinterStateReasons prnStateReasons = getAttribute(PrinterStateReasons.class);
    if(prnStateReasons != null){
        attrs.add(prnStateReasons);
    }
    QueuedJobCount jobCount = getAttribute(QueuedJobCount.class);
    if(jobCount != null){
        attrs.add(jobCount);
    }
    // TODO: Seems to be more accurate than settings.get_SupportsColor(), which doesn't work for CutePDF
    if(settings.get_DefaultPageSettings().get_Color()){
        attrs.add(ColorSupported.SUPPORTED);
    }else{
        attrs.add(ColorSupported.NOT_SUPPORTED);
    }

    return AttributeSetUtilities.unmodifiableView(attrs);
}
项目:jdk8u-jdk    文件:Win32PrintService.java   
private QueuedJobCount getQueuedJobCount() {

        int count = getJobStatus(printer, 1);
        if (count != -1) {
            return new QueuedJobCount(count);
        }
        else {
            return new QueuedJobCount(0);
        }
    }
项目:jdk8u-jdk    文件:Win32PrintService.java   
public <T extends PrintServiceAttribute> T
    getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }
    if (category == ColorSupported.class) {
        int caps = getPrinterCapabilities();
        if ((caps & DEVCAP_COLOR) != 0) {
            return (T)ColorSupported.SUPPORTED;
        } else {
            return (T)ColorSupported.NOT_SUPPORTED;
        }
    } else if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:jdk8u-jdk    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountSysV() {
    String command = "/usr/bin/lpstat -R " + printer;
    String results[]= UnixPrintServiceLookup.execCmd(command);
    int qlen = (results == null) ? 0 : results.length;

    return new QueuedJobCount(qlen);
}
项目:jdk8u-jdk    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountBSD() {
    if (UnixPrintServiceLookup.cmdIndex ==
        UnixPrintServiceLookup.UNINITIALIZED) {

        UnixPrintServiceLookup.cmdIndex =
            UnixPrintServiceLookup.getBSDCommandIndex();
    }

    int qlen = 0;
    String command = "/usr/sbin/lpc status " + printer
        + lpcQueueCom[UnixPrintServiceLookup.cmdIndex];
    String results[] = UnixPrintServiceLookup.execCmd(command);

    if (results != null && results.length > 0) {
        String queued;
        if (UnixPrintServiceLookup.cmdIndex ==
            UnixPrintServiceLookup.BSD_LPD_NG) {
            queued = results[0];
        } else {
            queued = results[3].trim();
            if (queued.startsWith("no")) {
                return new QueuedJobCount(0);
            } else {
                queued = queued.substring(0, queued.indexOf(' '));
            }
        }

        try {
            qlen = Integer.parseInt(queued);
        } catch (NumberFormatException e) {
        }
    }

    return new QueuedJobCount(qlen);
}
项目:jdk8u-jdk    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCount() {
    if (UnixPrintServiceLookup.isSysV()) {
        return getQueuedJobCountSysV();
    } else if (UnixPrintServiceLookup.isBSD()) {
        return getQueuedJobCountBSD();
    } else if (UnixPrintServiceLookup.isAIX()) {
        return getQueuedJobCountAIX();
    } else {
        return new QueuedJobCount(0);
    }
}
项目:openjdk-jdk10    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountSysV() {
    String command = "/usr/bin/lpstat -R " + printer;
    String results[]= PrintServiceLookupProvider.execCmd(command);
    int qlen = (results == null) ? 0 : results.length;

    return new QueuedJobCount(qlen);
}
项目:openjdk-jdk10    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountBSD() {
    if (PrintServiceLookupProvider.cmdIndex ==
        PrintServiceLookupProvider.UNINITIALIZED) {

        PrintServiceLookupProvider.cmdIndex =
            PrintServiceLookupProvider.getBSDCommandIndex();
    }

    int qlen = 0;
    String command = "/usr/sbin/lpc status " + printer
        + lpcQueueCom[PrintServiceLookupProvider.cmdIndex];
    String results[] = PrintServiceLookupProvider.execCmd(command);

    if (results != null && results.length > 0) {
        String queued;
        if (PrintServiceLookupProvider.cmdIndex ==
            PrintServiceLookupProvider.BSD_LPD_NG) {
            queued = results[0];
        } else {
            queued = results[3].trim();
            if (queued.startsWith("no")) {
                return new QueuedJobCount(0);
            } else {
                queued = queued.substring(0, queued.indexOf(' '));
            }
        }

        try {
            qlen = Integer.parseInt(queued);
        } catch (NumberFormatException e) {
        }
    }

    return new QueuedJobCount(qlen);
}
项目:openjdk-jdk10    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCount() {
    if (PrintServiceLookupProvider.isSysV()) {
        return getQueuedJobCountSysV();
    } else if (PrintServiceLookupProvider.isBSD()) {
        return getQueuedJobCountBSD();
    } else if (PrintServiceLookupProvider.isAIX()) {
        return getQueuedJobCountAIX();
    } else {
        return new QueuedJobCount(0);
    }
}
项目:openjdk-jdk10    文件:Win32PrintService.java   
private QueuedJobCount getQueuedJobCount() {

        int count = getJobStatus(printer, 1);
        if (count != -1) {
            return new QueuedJobCount(count);
        }
        else {
            return new QueuedJobCount(0);
        }
    }
项目:openjdk-jdk10    文件:Win32PrintService.java   
@SuppressWarnings("unchecked")
public <T extends PrintServiceAttribute> T
    getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }
    if (category == ColorSupported.class) {
        int caps = getPrinterCapabilities();
        if ((caps & DEVCAP_COLOR) != 0) {
            return (T)ColorSupported.SUPPORTED;
        } else {
            return (T)ColorSupported.NOT_SUPPORTED;
        }
    } else if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:openjdk9    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountSysV() {
    String command = "/usr/bin/lpstat -R " + printer;
    String results[]= PrintServiceLookupProvider.execCmd(command);
    int qlen = (results == null) ? 0 : results.length;

    return new QueuedJobCount(qlen);
}
项目:openjdk9    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCountBSD() {
    if (PrintServiceLookupProvider.cmdIndex ==
        PrintServiceLookupProvider.UNINITIALIZED) {

        PrintServiceLookupProvider.cmdIndex =
            PrintServiceLookupProvider.getBSDCommandIndex();
    }

    int qlen = 0;
    String command = "/usr/sbin/lpc status " + printer
        + lpcQueueCom[PrintServiceLookupProvider.cmdIndex];
    String results[] = PrintServiceLookupProvider.execCmd(command);

    if (results != null && results.length > 0) {
        String queued;
        if (PrintServiceLookupProvider.cmdIndex ==
            PrintServiceLookupProvider.BSD_LPD_NG) {
            queued = results[0];
        } else {
            queued = results[3].trim();
            if (queued.startsWith("no")) {
                return new QueuedJobCount(0);
            } else {
                queued = queued.substring(0, queued.indexOf(' '));
            }
        }

        try {
            qlen = Integer.parseInt(queued);
        } catch (NumberFormatException e) {
        }
    }

    return new QueuedJobCount(qlen);
}
项目:openjdk9    文件:UnixPrintService.java   
private QueuedJobCount getQueuedJobCount() {
    if (PrintServiceLookupProvider.isSysV()) {
        return getQueuedJobCountSysV();
    } else if (PrintServiceLookupProvider.isBSD()) {
        return getQueuedJobCountBSD();
    } else if (PrintServiceLookupProvider.isAIX()) {
        return getQueuedJobCountAIX();
    } else {
        return new QueuedJobCount(0);
    }
}