summaryrefslogtreecommitdiff
path: root/NET/worlds/network/ServerURL.java
blob: 7d6ac4a5b69f3ee802501cb2ab52c9f1440ed4ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*    */ package NET.worlds.network;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class ServerURL
/*    */ {
/* 38 */   private String _serverType = null;
/* 39 */   private String _serverHost = null;
/* 40 */   private String _serverOptions = null;
/*    */   
/*    */   public String getHost() {
/* 43 */     return this._serverHost;
/*    */   }
/*    */   
/*    */   public String getType() {
/* 47 */     return this._serverType;
/*    */   }
/*    */   
/*    */   public ServerURL(String serverURL) throws InvalidServerURLException
/*    */   {
/* 52 */     String origServerURL = serverURL;
/* 53 */     int txtPos = serverURL.indexOf("://");
/* 54 */     if (txtPos >= 0) {
/* 55 */       String protocol = serverURL.substring(0, txtPos);
/* 56 */       assert (protocol.equals("worldserver"));
/* 57 */       serverURL = serverURL.substring(txtPos + 3);
/*    */     }
/*    */     
/* 60 */     int typePos = serverURL.indexOf('/');
/* 61 */     if (typePos >= 0) {
/* 62 */       this._serverHost = serverURL.substring(0, typePos);
/* 63 */       serverURL = serverURL.substring(typePos + 1);
/*    */     }
/*    */     else {
/* 66 */       this._serverHost = serverURL;
/* 67 */       serverURL = "AutoServer";
/*    */     }
/*    */     
/* 70 */     int optPos = serverURL.indexOf('/');
/* 71 */     if (optPos >= 0) {
/* 72 */       this._serverType = serverURL.substring(0, optPos);
/* 73 */       serverURL = serverURL.substring(optPos + 1);
/*    */     }
/*    */     else {
/* 76 */       this._serverType = serverURL;
/* 77 */       serverURL = "";
/*    */     }
/*    */     
/* 80 */     this._serverOptions = serverURL;
/*    */     
/* 82 */     if (this._serverHost.length() == 0)
/* 83 */       throw new InvalidServerURLException("Invalid server URL: " + 
/* 84 */         origServerURL);
/* 85 */     if (this._serverType.length() == 0) {
/* 86 */       this._serverType = "AutoServer";
/*    */     }
/*    */   }
/*    */   
/*    */   public String toString()
/*    */   {
/* 92 */     return 
/* 93 */       "worldserver://" + this._serverHost + "/" + this._serverType + "/" + this._serverOptions;
/*    */   }
/*    */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\network\ServerURL.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */