org.jscience.net
Class LocalWeb

java.lang.Object
  extended by org.jscience.net.LocalWeb
All Implemented Interfaces:
java.io.Serializable

public class LocalWeb
extends java.lang.Object
implements java.io.Serializable

LocalWeb represents a website based on the local file system.

Since:
4/11/03
See Also:
Serialized Form

Field Summary
static org.jscience.net.LocalWeb.HTMLFileFilter htmlFilter
           
static org.jscience.net.LocalWeb.ImageFileFilter imageFilter
           
 
Constructor Summary
LocalWeb(java.io.File webDir, java.io.File webRoot)
          the webRoot must exist and be within the webDir
 
Method Summary
 long calculateAccessibleWebSize()
           
 java.io.File[] filesContainingLink(java.net.URL link)
           
 java.io.File[] filesContainingLinks(java.net.URL[] link)
           
 java.net.URL[] findBrokenLinks()
          finds links to URLs that are not accessible
 java.io.File[] findBrokenLocalLinks()
          finds links to local files that do not exist
 java.io.File[] findLinksTo(java.io.File file)
           
 java.io.File[] findLocalLinksOutsideDir()
          checks whether any linked local files are outside the web directory
 java.io.File[] findOrphans()
           
 java.io.File[] getDataFiles()
           
 java.lang.String[] getFileTypes()
           
 java.io.File[] getHTMLFiles()
           
 java.io.File[] getImageFiles()
           
 java.io.File[] getLinkedFiles()
          returns a set of all files all files within this web that are accessible from the root
 java.io.File[] getLinkedFiles(java.io.File file)
          returns a set of all files within this web that are accessible from the given file.
 ExtendedFile getWebDir()
           
 ExtendedFile getWebRoot()
           
static java.io.File toFile(java.net.URL url)
          returns the canonical file or null if the URL doesn't point to a valid file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

htmlFilter

public static final org.jscience.net.LocalWeb.HTMLFileFilter htmlFilter

imageFilter

public static final org.jscience.net.LocalWeb.ImageFileFilter imageFilter
Constructor Detail

LocalWeb

public LocalWeb(java.io.File webDir,
                java.io.File webRoot)
         throws java.lang.IllegalArgumentException
the webRoot must exist and be within the webDir

Throws:
java.lang.IllegalArgumentException
Method Detail

getWebRoot

public ExtendedFile getWebRoot()

getWebDir

public ExtendedFile getWebDir()

getLinkedFiles

public java.io.File[] getLinkedFiles()
                              throws java.io.IOException
returns a set of all files all files within this web that are accessible from the root

Throws:
java.io.IOException

calculateAccessibleWebSize

public long calculateAccessibleWebSize()
                                throws java.io.IOException
Throws:
java.io.IOException

findLocalLinksOutsideDir

public java.io.File[] findLocalLinksOutsideDir()
                                        throws java.io.IOException
checks whether any linked local files are outside the web directory

Throws:
java.io.IOException

getLinkedFiles

public java.io.File[] getLinkedFiles(java.io.File file)
                              throws java.io.IOException
returns a set of all files within this web that are accessible from the given file. The file must be from within the web.

Throws:
java.io.IOException

getHTMLFiles

public java.io.File[] getHTMLFiles()

getImageFiles

public java.io.File[] getImageFiles()

getDataFiles

public java.io.File[] getDataFiles()

getFileTypes

public java.lang.String[] getFileTypes()

findOrphans

public java.io.File[] findOrphans()
                           throws java.io.IOException
Throws:
java.io.IOException

filesContainingLink

public java.io.File[] filesContainingLink(java.net.URL link)

filesContainingLinks

public java.io.File[] filesContainingLinks(java.net.URL[] link)

findBrokenLinks

public java.net.URL[] findBrokenLinks()
finds links to URLs that are not accessible


findBrokenLocalLinks

public java.io.File[] findBrokenLocalLinks()
finds links to local files that do not exist


findLinksTo

public java.io.File[] findLinksTo(java.io.File file)
                           throws java.io.IOException
Throws:
java.io.IOException

toFile

public static java.io.File toFile(java.net.URL url)
returns the canonical file or null if the URL doesn't point to a valid file