net.aerith.misao.util
Class URLSet

java.lang.Object
  |
  +--net.aerith.misao.util.URLSet

public class URLSet
extends java.lang.Object

The URLSet represents a set of URLs. It has functions such as to check existence of files in any directory in this set.


Field Summary
protected  boolean accept_gzipped
          True when to accept the gzipped files.
protected  boolean ignore_cases
          True when to ignore cases.
protected  java.util.Vector list
          The list of URLs.
 
Constructor Summary
URLSet()
          Constructs an empty URLSet.
 
Method Summary
 void acceptGzipped(boolean flag)
          Sets the flag to accept gzipped files when checks the existence of file.
 void addURL(java.net.URL new_url)
          Adds an URL.
 boolean empty()
          True if no URL is set.
 java.net.URL exists()
          Checks if any of the URLs in this set exists.
 java.net.URL existsFile(java.lang.String filename)
          Checks if the specified file exists in any directory in this set.
private  java.net.URL existsGzipped(java.net.URL url)
          Checks if the gzipped file of the specified URL exists.
 void ignoreCases(boolean flag)
          Sets the flag to ignore cases when checks the existence of file.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

list

protected java.util.Vector list
The list of URLs.

ignore_cases

protected boolean ignore_cases
True when to ignore cases.

accept_gzipped

protected boolean accept_gzipped
True when to accept the gzipped files.
Constructor Detail

URLSet

public URLSet()
Constructs an empty URLSet.
Method Detail

addURL

public void addURL(java.net.URL new_url)
Adds an URL.
Parameters:
new_url - the new URL to add.

empty

public boolean empty()
True if no URL is set.
Returns:
true if no URL is set.

ignoreCases

public void ignoreCases(boolean flag)
Sets the flag to ignore cases when checks the existence of file.
Parameters:
flag - true when to ignore cases.

acceptGzipped

public void acceptGzipped(boolean flag)
Sets the flag to accept gzipped files when checks the existence of file.
Parameters:
flag - true when to accept gzipped files.

exists

public java.net.URL exists()
                    throws java.io.FileNotFoundException
Checks if any of the URLs in this set exists. If exists, it returns the URL of the file.
Returns:
the URL of the file if exists.
Throws:
java.io.FileNotFoundException - if any of the URLs in this set does not exist.

existsFile

public java.net.URL existsFile(java.lang.String filename)
                        throws java.io.FileNotFoundException
Checks if the specified file exists in any directory in this set. If exists, it returns the URL of the file.
Parameters:
filename - the file name to check.
Returns:
the URL of the file if exists.
Throws:
java.io.FileNotFoundException - if the specified file does not exist in any directory in this set.

existsGzipped

private java.net.URL existsGzipped(java.net.URL url)
                            throws java.io.FileNotFoundException
Checks if the gzipped file of the specified URL exists. If exists, it returns the URL of the gzipped file.
Parameters:
url - the URL to check.
Returns:
the URL of the gzipped file if exists.
Throws:
java.io.FileNotFoundException - if the gzipped file of the specified URL does not exist.