My code is the following: class PrintDoc implements Doc { private String filename; private InputStream stream; public PrintDoc(String fname) { this.filename = fname; } public DocFlavor getDocFlavor() { if (this.filename.substring(this.filename.indexOf(".")+1).toUpperCase().equals("XML")) { return new DocFlavor("application/xml", "java.io.InputStream"); } else if (this.filename.substring(this.filename.indexOf(".")+1).toUpperCase().equals("PDF")) { return DocFlavor.INPUT_STREAM.PDF; } else if (this.filename.substring(this.filename.indexOf(".")+1).toUpperCase().equals("GIF")) { return DocFlavor.INPUT_STREAM.GIF; } else { return DocFlavor.INPUT_STREAM.AUTOSENSE; } } // No attributes attached to ...