Java Reference
In-Depth Information
catch(Exception e){ forecast = e.getMessage(); }
finally {
try {
if (in!=null) hc.close();
if (out!=null) hc.close();
if (hc!=null) hc.close();
}
catch(Exception e) {}
}
if (!cancelled) {
location.setForecast(forecast);
app.update();
}
}
private static String urlEncode(String s)
{
if (s!=null) {
StringBuffer tmp = new StringBuffer();
int i=0;
try {
while (true) {
int b = (int)s.charAt(i++);
if ((b>=0x30 && b<=0x39) || /* 0-9 */
(b>=0x41 && b<=0x5A) || /* A-Z */
(b>=0x61 && b<=0x7A)) { /* a-z */
tmp.append((char)b);
} else {
tmp.append("%");
if (b <= 0xf) tmp.append("0");
tmp.append(Integer.toHexString(b));
}
}
}
catch (Exception e) {}
return tmp.toString();
}
return null;
}
}
 
Search WWH ::




Custom Search