Java Reference
In-Depth Information
L ISTING 6.2 Continued
6
System.out.println(“ApplicationHelper()- Couldn't work out the
connection: “+e);
offline = true;
if
(appHelperSettings.getProperty(OFFLINE_ALLOWED).equalsIgnoreCase(“false”)){
System.out.println(“ApplicationHelper()- Cannot execute offline.”);
System.exit(-1);
}
}
try {
if (!offline)
check();
} catch (Exception e) {
System.out.println(“ApplicationHelper()- check()”+e);
}
}
/**
* It implements the check command
*/
public void check() throws IOException{
try {
out.writeChar('c');
out.writeUTF(thisClientId);
int newItems = in.readInt();
if (newItems!=0) {
//there is a new version in sight
//we must download it
byte[] b;
for (int i = 0; i < newItems; i++) {
// download a new file in cache
String fileName = in.readUTF();
int size = in.readInt();
b = new byte[size];
in.readFully(b);
cache(fileName, b);
}
//read the class to be launched
String launch = in.readUTF();
if (launch!=””)
launchClassName = launch;
}//-(newItems!=0)
} catch (Exception e) {
System.out.println(“ApplicationHelper- check() “+e);
Search WWH ::




Custom Search