Java Reference
In-Depth Information
L ISTING D.7 Continued
try {
FileOutputStream outputstream = new FileOutputStream(newFile);
while((i = source.read(buffer)) != -1)
outputstream.write(buffer, 0, i);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
if(source != null)
source.close();
} catch (Exception exx) {
System.out.println(“closing InputStream “+exx);
}
}
return new FileContentsImpl(newFile);
}
}
PrintServiceImpl
This service implementation supports basic printing via the JNLP runtime services API. Its
implementation is shown in Listing D.8.
L ISTING D.8 The PrintServiceImpl class.
package com.marinilli.b2.ad.util;
import javax.jnlp.PrintService;
import java.awt.print.*;
/**
* Appendix D - Implementation of the corresponding JNLP runtime service
*
* @author Mauro Marinilli
* @version 1.0
*/
public class PrintServiceImpl implements PrintService {
private PrinterJob job;
/**
* constructor
*/
public PrintServiceImpl() {
Search WWH ::




Custom Search