home *** CD-ROM | disk | FTP | other *** search
- package sun.net;
-
- public class ProgressEntry {
- public static final int HTML = 0;
- public static final int IMAGE = 1;
- public static final int CLASS = 2;
- public static final int AUDIO = 3;
- public static final int OTHER = 4;
- public int need;
- public int read;
- public int what;
- public int index;
- public boolean connected = false;
- public String label;
- public int type;
-
- public ProgressEntry(String var1, String var2) {
- this.label = var1;
- this.type = 4;
- this.need = 0;
- this.setType(var1, var2);
- }
-
- public void setType(String var1, String var2) {
- if (var2 != null) {
- if (var2.startsWith("image")) {
- this.type = 1;
- } else if (var2.startsWith("audio")) {
- this.type = 3;
- } else if (var2.equals("application/java-vm")) {
- this.type = 2;
- } else if (var2.startsWith("text/html")) {
- this.type = 0;
- }
- }
-
- if (this.type == 4) {
- if (var1.endsWith(".html") || var1.endsWith("/") || var1.endsWith(".htm")) {
- this.type = 0;
- return;
- }
-
- if (var1.endsWith(".class")) {
- this.type = 2;
- return;
- }
-
- if (var1.endsWith(".gif") || var1.endsWith(".xbm") || var1.endsWith(".jpeg") || var1.endsWith(".jpg") || var1.endsWith(".jfif")) {
- this.type = 1;
- return;
- }
-
- if (var1.endsWith(".au")) {
- this.type = 3;
- }
- }
-
- }
-
- public void update(int var1, int var2) {
- if (this.need == 0) {
- this.need = var2;
- }
-
- this.read = var1;
- }
-
- public synchronized boolean connected() {
- if (!this.connected) {
- this.connected = true;
- return false;
- } else {
- return true;
- }
- }
- }
-