throw new PrintException("Printer is not accepting job.");
}
this.doc = doc;
/* check if the parameters are valid before doing much processing */
DocFlavor flavor = doc.getDocFlavor();
Object data;
try{
data = doc.getPrintData();
}catch(IOException e){
notifyEvent(PrintJobEvent.JOB_FAILED);
throw new PrintException("can't get print data: " + e.toString());
}
if(flavor == null || (!service.isDocFlavorSupported(flavor))){
notifyEvent(PrintJobEvent.JOB_FAILED);
throw new PrintJobFlavorException("invalid flavor", flavor);
}
initializeAttributeSets(doc, attributes);
getAttributeValues(flavor);
String repClassName = flavor.getRepresentationClassName();
if(flavor.equals(DocFlavor.INPUT_STREAM.GIF) || flavor.equals(DocFlavor.INPUT_STREAM.JPEG)
|| flavor.equals(DocFlavor.INPUT_STREAM.PNG) || flavor.equals(DocFlavor.BYTE_ARRAY.GIF)
|| flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) || flavor.equals(DocFlavor.BYTE_ARRAY.PNG)){
try{
instream = doc.getStreamForBytes();
if(instream == null){
notifyEvent(PrintJobEvent.JOB_FAILED);
throw new PrintException("No stream for data");
}
printableJob(new ImagePrinter(instream));
service.wakeNotifier();
return;
}catch(ClassCastException cce){
notifyEvent(PrintJobEvent.JOB_FAILED);
throw new PrintException(cce);
}catch(IOException ioe){
notifyEvent(PrintJobEvent.JOB_FAILED);
throw new PrintException(ioe);
}
}else if(flavor.equals(DocFlavor.URL.GIF) || flavor.equals(DocFlavor.URL.JPEG)
|| flavor.equals(DocFlavor.URL.PNG)){
try{
printableJob(new ImagePrinter((URL)data));
service.wakeNotifier();
return;
}catch(ClassCastException cce){