Java 类javax.print.attribute.standard.PrinterURI 实例源码
项目:openjdk-jdk10
文件:PrintServiceLookupProvider.java
private int addPrintServiceToList(ArrayList<PrintService> printerList, PrintService ps) {
int index = printerList.indexOf(ps);
// Check if PrintService with same name is already in the list.
if (CUPSPrinter.isCupsRunning() && index != -1) {
// Bug in Linux: Duplicate entry of a remote printer
// and treats it as local printer but it is returning wrong
// information when queried using IPP. Workaround is to remove it.
// Even CUPS ignores these entries as shown in lpstat or using
// their web configuration.
PrinterURI uri = ps.getAttribute(PrinterURI.class);
if (uri.getURI().getHost().equals("localhost")) {
IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, ignoring the new local printer: "+ps);
return index; // Do not add this.
}
PrintService oldPS = printerList.get(index);
uri = oldPS.getAttribute(PrinterURI.class);
if (uri.getURI().getHost().equals("localhost")) {
IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, removing existing local printer: "+oldPS);
printerList.remove(oldPS);
} else {
return index;
}
}
printerList.add(ps);
return (printerList.size() - 1);
}
项目:openjdk9
文件:PrintServiceLookupProvider.java
private int addPrintServiceToList(ArrayList<PrintService> printerList, PrintService ps) {
int index = printerList.indexOf(ps);
// Check if PrintService with same name is already in the list.
if (CUPSPrinter.isCupsRunning() && index != -1) {
// Bug in Linux: Duplicate entry of a remote printer
// and treats it as local printer but it is returning wrong
// information when queried using IPP. Workaround is to remove it.
// Even CUPS ignores these entries as shown in lpstat or using
// their web configuration.
PrinterURI uri = ps.getAttribute(PrinterURI.class);
if (uri.getURI().getHost().equals("localhost")) {
IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, ignoring the new local printer: "+ps);
return index; // Do not add this.
}
PrintService oldPS = printerList.get(index);
uri = oldPS.getAttribute(PrinterURI.class);
if (uri.getURI().getHost().equals("localhost")) {
IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, removing existing local printer: "+oldPS);
printerList.remove(oldPS);
} else {
return index;
}
}
printerList.add(ps);
return (printerList.size() - 1);
}
项目:javify
文件:IppPrintService.java
/**
* Creates a <code>IppPrintService</code> object.
*
* @param uri the URI of the IPP printer.
* @param username the user of this print service.
* @param password the password of the user.
*
* @throws IppException if an error during connection occurs.
*/
public IppPrintService(URI uri, String username, String password)
throws IppException
{
printerUri = new PrinterURI(uri);
user = username;
passwd = password;
printServiceAttributeListener =
new HashSet<PrintServiceAttributeListener>();
printerAttr = getPrinterAttributes();
processResponse();
}
项目:jvm-stm
文件:IppPrintService.java
/**
* Creates a <code>IppPrintService</code> object.
*
* @param uri the URI of the IPP printer.
* @param username the user of this print service.
* @param password the password of the user.
*
* @throws IppException if an error during connection occurs.
*/
public IppPrintService(URI uri, String username, String password)
throws IppException
{
printerUri = new PrinterURI(uri);
user = username;
passwd = password;
printServiceAttributeListener = new HashSet();
printerAttr = getPrinterAttributes();
processResponse();
}
项目:JamVM-PH
文件:IppPrintService.java
/**
* Creates a <code>IppPrintService</code> object.
*
* @param uri the URI of the IPP printer.
* @param username the user of this print service.
* @param password the password of the user.
*
* @throws IppException if an error during connection occurs.
*/
public IppPrintService(URI uri, String username, String password)
throws IppException
{
printerUri = new PrinterURI(uri);
user = username;
passwd = password;
printServiceAttributeListener = new HashSet();
printerAttr = getPrinterAttributes();
processResponse();
}
项目:classpath
文件:IppPrintService.java
/**
* Creates a <code>IppPrintService</code> object.
*
* @param uri the URI of the IPP printer.
* @param username the user of this print service.
* @param password the password of the user.
*
* @throws IppException if an error during connection occurs.
*/
public IppPrintService(URI uri, String username, String password)
throws IppException
{
printerUri = new PrinterURI(uri);
user = username;
passwd = password;
printServiceAttributeListener =
new HashSet<PrintServiceAttributeListener>();
printerAttr = getPrinterAttributes();
processResponse();
}
项目:jvm-stm
文件:IppRequest.java
/**
* Writes the given operation attribute group of the given map instance
* (key=group, values=set of attributes) into the supplied data
* output stream.
*
* @param attributes the set with the attributes.
*
* @throws IOException if thrown by the used DataOutputStream.
* @throws IppException if unknown attributes occur.
*/
public void writeOperationAttributes(AttributeSet attributes)
throws IOException, IppException
{
out.write(IppDelimiterTag.OPERATION_ATTRIBUTES_TAG);
// its essential to write these two in this order and as first ones
Attribute att = attributes.get(AttributesCharset.class);
write((CharsetSyntax) att);
logger.log(Component.IPP, "Attribute: Name: <"
+ att.getCategory().getName() + "> Value: <" + att.toString() + ">");
attributes.remove(AttributesCharset.class);
att = attributes.get(AttributesNaturalLanguage.class);
write((NaturalLanguageSyntax) att);
attributes.remove(AttributesNaturalLanguage.class);
logger.log(Component.IPP, "Attribute: Name: <"
+ att.getCategory().getName() + "> Value: <" + att.toString() + ">");
// furthermore its essential to now write out the target attribute
PrinterURI printerUri = (PrinterURI) attributes.get(PrinterURI.class);
JobUri jobUri = (JobUri) attributes.get(JobUri.class);
JobId jobId = (JobId) attributes.get(JobId.class);
if (printerUri != null && jobId == null && jobUri == null)
{
write(printerUri);
attributes.remove(PrinterURI.class);
logger.log(Component.IPP, "Attribute: Name: <" + printerUri
.getCategory().getName() + "> Value: <" + printerUri.toString() + ">");
}
else if (jobUri != null && jobId == null && printerUri == null)
{
write(jobUri);
attributes.remove(JobUri.class);
logger.log(Component.IPP, "Attribute: Name: <" + jobUri
.getCategory().getName() + "> Value: <" + jobUri.toString() + ">");
}
else if (printerUri != null && jobId != null && jobUri == null)
{
write(printerUri); // must be third
write(jobId);
attributes.remove(PrinterURI.class);
attributes.remove(JobId.class);
logger.log(Component.IPP, "Attribute: Name: <" + printerUri
.getCategory().getName() + "> Value: <" + printerUri.toString() + ">");
logger.log(Component.IPP, "Attribute: Name: <" + jobId.getCategory()
.getName() + "> Value: <" + jobId.toString() + ">");
}
else if (jobUri != null && jobId != null)
{
write(jobUri);
attributes.remove(JobUri.class);
attributes.remove(JobId.class); // MUST NOT redundant
logger.log(Component.IPP, "Attribute: Name: <" + jobUri.getCategory()
.getName() + "> Value: <" + jobUri.toString() + ">");
}
else
{
throw new IppException("Unknown target operation attribute combination.");
}
writeAttributes(attributes);
}
项目:JamVM-PH
文件:IppRequest.java
/**
* Writes the given operation attribute group of the given map instance
* (key=group, values=set of attributes) into the supplied data
* output stream.
*
* @param attributes the set with the attributes.
*
* @throws IOException if thrown by the used DataOutputStream.
* @throws IppException if unknown attributes occur.
*/
public void writeOperationAttributes(AttributeSet attributes)
throws IOException, IppException
{
out.write(IppDelimiterTag.OPERATION_ATTRIBUTES_TAG);
// its essential to write these two in this order and as first ones
Attribute att = attributes.get(AttributesCharset.class);
write((CharsetSyntax) att);
logger.log(Component.IPP, "Attribute: Name: <"
+ att.getCategory().getName() + "> Value: <" + att.toString() + ">");
attributes.remove(AttributesCharset.class);
att = attributes.get(AttributesNaturalLanguage.class);
write((NaturalLanguageSyntax) att);
attributes.remove(AttributesNaturalLanguage.class);
logger.log(Component.IPP, "Attribute: Name: <"
+ att.getCategory().getName() + "> Value: <" + att.toString() + ">");
// furthermore its essential to now write out the target attribute
PrinterURI printerUri = (PrinterURI) attributes.get(PrinterURI.class);
JobUri jobUri = (JobUri) attributes.get(JobUri.class);
JobId jobId = (JobId) attributes.get(JobId.class);
if (printerUri != null && jobId == null && jobUri == null)
{
write(printerUri);
attributes.remove(PrinterURI.class);
logger.log(Component.IPP, "Attribute: Name: <" + printerUri
.getCategory().getName() + "> Value: <" + printerUri.toString() + ">");
}
else if (jobUri != null && jobId == null && printerUri == null)
{
write(jobUri);
attributes.remove(JobUri.class);
logger.log(Component.IPP, "Attribute: Name: <" + jobUri
.getCategory().getName() + "> Value: <" + jobUri.toString() + ">");
}
else if (printerUri != null && jobId != null && jobUri == null)
{
write(printerUri); // must be third
write(jobId);
attributes.remove(PrinterURI.class);
attributes.remove(JobId.class);
logger.log(Component.IPP, "Attribute: Name: <" + printerUri
.getCategory().getName() + "> Value: <" + printerUri.toString() + ">");
logger.log(Component.IPP, "Attribute: Name: <" + jobId.getCategory()
.getName() + "> Value: <" + jobId.toString() + ">");
}
else if (jobUri != null && jobId != null)
{
write(jobUri);
attributes.remove(JobUri.class);
attributes.remove(JobId.class); // MUST NOT redundant
logger.log(Component.IPP, "Attribute: Name: <" + jobUri.getCategory()
.getName() + "> Value: <" + jobUri.toString() + ">");
}
else
{
throw new IppException("Unknown target operation attribute combination.");
}
writeAttributes(attributes);
}
项目:javify
文件:IppPrintService.java
/**
* Returns the printer-uri of this print service.
*
* @return The printer-uri attribute.
*/
public PrinterURI getPrinterURI()
{
return printerUri;
}
项目:jvm-stm
文件:IppPrintService.java
/**
* Returns the printer-uri of this print service.
*
* @return The printer-uri attribute.
*/
public PrinterURI getPrinterURI()
{
return printerUri;
}
项目:JamVM-PH
文件:IppPrintService.java
/**
* Returns the printer-uri of this print service.
*
* @return The printer-uri attribute.
*/
public PrinterURI getPrinterURI()
{
return printerUri;
}
项目:classpath
文件:IppPrintService.java
/**
* Returns the printer-uri of this print service.
*
* @return The printer-uri attribute.
*/
public PrinterURI getPrinterURI()
{
return printerUri;
}