/* */ package NET.worlds.network; /* */ /* */ import NET.worlds.console.Cursor; /* */ import java.util.Observer; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class CacheFile /* */ { /* */ private URL url; /* */ private CacheEntry entry; /* */ private boolean active; /* */ /* */ CacheFile(URL u, CacheEntry e) /* */ { /* 72 */ this.url = u; /* 73 */ this.active = true; /* 74 */ this.entry = e; /* 75 */ if (e != null) { /* 76 */ e.incRef(); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public void finalize() /* */ { /* 86 */ if (this.active) { /* 87 */ this.active = false; /* 88 */ if (this.entry != null) { /* 89 */ this.entry.safeDecRef(); /* */ } /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public synchronized void close() /* */ { /* 101 */ finalize(); /* */ } /* */ /* */ /* */ /* */ /* */ public synchronized void markTemporary() /* */ { /* 109 */ if (this.entry != null) /* */ { /* */ /* 112 */ this.entry.remoteTime = 0L; /* */ } /* */ } /* */ /* */ public boolean isActive() /* */ { /* 118 */ return this.active; /* */ } /* */ /* */ /* */ /* */ public void load() /* */ { /* 125 */ this.entry.load(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void callWhenLoaded(Observer o) /* */ { /* 138 */ if (this.entry == null) { /* 139 */ o.update(null, this.url); /* */ } else { /* 141 */ this.entry.addObserver(o); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public void waitUntilLoaded() /* */ { /* 150 */ if (this.entry != null) { /* 151 */ synchronized (this.entry) /* */ { /* 153 */ Cursor c = Cursor.getActive(); /* 154 */ if (c == null) { /* 155 */ c = new Cursor(URL.make("system:WAIT_CURSOR")); /* 156 */ c.activate(); /* */ } /* */ /* 159 */ URL oldCursor = c.getURL(); /* 160 */ c.setURL(URL.make("system:WAIT_CURSOR")); /* 161 */ while ((this.active) && (!done())) { /* */ try { /* 163 */ this.entry.wait(); /* */ } /* */ catch (InterruptedException localInterruptedException) {} /* */ } /* */ /* 168 */ c.setURL(oldCursor); /* */ } /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public boolean error() /* */ { /* 178 */ if (this.entry == null) { /* 179 */ return false; /* */ } /* 181 */ return (this.entry.state == 5) || /* 182 */ (this.entry.state == 6); /* */ } /* */ /* */ /* */ /* */ /* */ public boolean done() /* */ { /* 190 */ if (this.entry == null) { /* 191 */ return true; /* */ } /* 193 */ return this.entry.done(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public String getLocalName() /* */ { /* 202 */ if (this.entry != null) { /* 203 */ return this.entry.localName; /* */ } /* 205 */ return this.url.unalias(); /* */ } /* */ /* */ /* */ /* */ /* */ public int bytesLoaded() /* */ { /* 213 */ return this.entry.bytes; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\network\CacheFile.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */