Java Reference
In-Depth Information
L ISTING 7.6 Continued
int j;
while((j = in.read(buffer)) != -1)
out.write(buffer, 0, j);
}//for
printMessage(“Installation finished.”);
} catch (Exception ex) {
printMessage(“copy: “+ex);
printMessage(“Installation aborted.”);
} finally {
try {
if(in != null)
in.close();
} catch (Exception ex) {
printMessage(“copy() closing InputStream “+ex);
}
}
}
/**
* overwritten for application support
*/
public URL getCodeBase() {
try {
if (isStandalone)
return new File(“.”).toURL();
} catch (MalformedURLException mue) {
System.out.println(“getCodebase() “+mue);
}
return super.getCodeBase();
}
/**
* tokenize a string
*/
private String[] getItems(String s){
if (s==null)
return null;
ArrayList result = new ArrayList();
StringTokenizer st = new StringTokenizer(s,”;:,”);
while (st.hasMoreTokens()) {
String w = st.nextToken();
result.add(w);
Search WWH ::




Custom Search