diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/network/CacheFile.java | |
| download | worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip | |
Diffstat (limited to 'NET/worlds/network/CacheFile.java')
| -rw-r--r-- | NET/worlds/network/CacheFile.java | 221 |
1 files changed, 221 insertions, 0 deletions
diff --git a/NET/worlds/network/CacheFile.java b/NET/worlds/network/CacheFile.java new file mode 100644 index 0000000..6deb82c --- /dev/null +++ b/NET/worlds/network/CacheFile.java @@ -0,0 +1,221 @@ +/* */ 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 + */
\ No newline at end of file |