Java Reference
In-Depth Information
L ISTING D.10 Continued
/**
* return a random access file
*/
public JNLPRandomAccessFile getRandomAccessFile(String p)
throws java.io.IOException {
System.out.println(“Method getRandomAccessFile not supported.”);
return null;
}
/**
* set the max length
* (Not supported)
*/
public long setMaxLength(long p) throws java.io.IOException {
System.out.println(“Method setMaxLength not supported.”);
return -1L;
}
}
An Example of Use
In this final section, we illustrate an example application that includes the utility package and
makes use of the generalUtilites class. This, in turn, will take care of providing the needed
JNLP runtime services to the application, even if this latter one is not launched via a JNLP file.
The services provided in this test class are only illustrative.
D
The Test Class
As an example of use of this library in Listing D.11 is supplied an application that makes use
of various JNLP runtime services. This class can be run seamlessly using a JNLP Client (the
JNLP file is provided in Listing D.12) or launching it locally as a usual JAR file.
L ISTING D.11 The Test Class
package com.marinilli.b2.ad;
import com.marinilli.b2.ad.util.*;
import javax.jnlp.*;
import java.net.URL;
import java.awt.print.*;
import java.awt.datatransfer.DataFlavor;
Search WWH ::




Custom Search