Rev 252 | Rev 382 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 252 | Rev 255 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | /*************************************************************** |
|
- | 2 | * |
|
- | 3 | * Helper functions for DUBwise |
|
- | 4 | * |
|
- | 5 | * Author: Marcus -LiGi- Bueschleb |
|
- | 6 | * Mailto: LiGi @at@ LiGi DOTT de |
|
- | 7 | * |
|
- | 8 | ***************************************************************/ |
|
- | 9 | ||
1 | import java.util.Vector; |
10 | import java.util.Vector; |
- | 11 | import java.io.*; |
|
- | 12 | import javax.microedition.io.*; |
|
- | 13 | ||
- | 14 | ||
Line 2... | Line 15... | ||
2 | 15 | ||
3 | public final class DUBwiseHelper |
16 | public final class DUBwiseHelper |
4 | { |
17 | { |
5 | public final static String ip_digit_zeroes(int digit) |
18 | public final static String ip_digit_zeroes(int digit) |
Line 24... | Line 37... | ||
24 | else |
37 | else |
25 | return ip[0]+"."+ip[1]+"."+ip[2]+"."+ip[3]+":"+ip[4]; |
38 | return ip[0]+"."+ip[1]+"."+ip[2]+"."+ip[3]+":"+ip[4]; |
Line 26... | Line 39... | ||
26 | 39 | ||
Line -... | Line 40... | ||
- | 40 | } |
|
- | 41 | ||
- | 42 | ||
- | 43 | ||
- | 44 | ||
- | 45 | ||
- | 46 | public final static String get_http_string(String url) |
|
- | 47 | { |
|
- | 48 | ||
- | 49 | try { |
|
- | 50 | ||
- | 51 | InputStream stream = null; |
|
- | 52 | StringBuffer buff = new StringBuffer(); |
|
- | 53 | StreamConnection conn=null; |
|
- | 54 | ||
- | 55 | System.out.println("starting conn"); |
|
- | 56 | conn = (StreamConnection)Connector.open(url); |
|
- | 57 | stream = conn.openInputStream(); |
|
- | 58 | int ch; |
|
- | 59 | ||
- | 60 | while((ch = stream.read()) != -1) |
|
- | 61 | buff.append((char) ch); |
|
- | 62 | ||
- | 63 | if(stream != null) |
|
- | 64 | stream.close(); |
|
- | 65 | ||
- | 66 | if(conn != null) |
|
- | 67 | conn.close(); |
|
- | 68 | ||
- | 69 | ||
- | 70 | return buff.toString(); |
|
- | 71 | ||
- | 72 | } |
|
- | 73 | catch ( Exception e) |
|
- | 74 | { |
|
- | 75 | return "err"; |
|
- | 76 | } |
|
- | 77 | ||
- | 78 | } |
|
- | 79 | ||
- | 80 | ||
- | 81 | ||
27 | } |
82 | |
28 | 83 | ||
29 | public final static int pow(int val,int pow) |
84 | public final static int pow(int val,int pow) |
Line 30... | Line 85... | ||
30 | { |
85 | { |
Line 35... | Line 90... | ||
35 | 90 | ||
36 | return res; |
91 | return res; |
Line -... | Line 92... | ||
- | 92 | } |
|
- | 93 | ||
- | 94 | ||
37 | } |
95 | |
38 | 96 | ||
Line 39... | Line 97... | ||
39 | 97 |