Holger's Java API

## com.antelmann.net
Class LocalWeb

    java.lang.Object
      com.antelmann.net.LocalWeb

All Implemented Interfaces:
  Serializable

    public class LocalWeb

extends Object
implements Serializable

LocalWeb represents a website based on the local file system.

Since:
  4/11/03
Author:
  Holger Antelmann
See Also:
  Serialized Form

Field Summary
`static com.antelmann.net.LocalWeb.HTMLFileFilter` `htmlFilter`
`static com.antelmann.net.LocalWeb.ImageFileFilter` `imageFilter`

Constructor Summary
`LocalWeb(File webDir, File webRoot)` the webRoot must exist and be within the webDir

Method Summary
`long` `calculateAccessibleWebSize()`
`File[]` `filesContainingLink(URL link)`
`File[]` `filesContainingLinks(URL[] link)`
`URL[]` `findBrokenLinks()` finds links to URLs that are not accessible
`File[]` `findBrokenLocalLinks()` finds links to local files that do not exist
`File[]` `findLinksTo(File file)`
`File[]` `findLocalLinksOutsideDir()` checks whether any linked local files are outside the web directory
`File[]` `findOrphans()`
`File[]` `getDataFiles()`
`String[]` `getFileTypes()`
`File[]` `getHTMLFiles()`
`File[]` `getImageFiles()`
`File[]` `getLinkedFiles()` returns a set of all files all files within this web that are accessible from the root
`File[]` `getLinkedFiles(File file)` returns a set of all files within this web that are accessible from the given file.
`MyFile` `getWebDir()`
`MyFile` `getWebRoot()`
`static File` `toFile(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 com.antelmann.net.LocalWeb.HTMLFileFilter htmlFilter

### imageFilter

    public static final com.antelmann.net.LocalWeb.ImageFileFilter imageFilter

Constructor Detail

### LocalWeb

    public LocalWeb(File webDir,
                    File webRoot)
             throws IllegalArgumentException

  the webRoot must exist and be within the webDir

  Throws:
    `IllegalArgumentException`

Method Detail

### getWebRoot

    public MyFile getWebRoot()

### getWebDir

    public MyFile getWebDir()

### getLinkedFiles

    public File[] getLinkedFiles()
                          throws IOException

  returns a set of all files all files within this web that are accessible from the root

  Throws:
    `IOException`

### calculateAccessibleWebSize

    public long calculateAccessibleWebSize()
                                    throws IOException

  Throws:
    `IOException`

### findLocalLinksOutsideDir

    public File[] findLocalLinksOutsideDir()
                                    throws IOException

  checks whether any linked local files are outside the web directory

  Throws:
    `IOException`

### getLinkedFiles

    public File[] getLinkedFiles(File file)
                          throws 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:
    `IOException`

### getHTMLFiles

    public File[] getHTMLFiles()

### getImageFiles

    public File[] getImageFiles()

### getDataFiles

    public File[] getDataFiles()

### getFileTypes

    public String[] getFileTypes()

### findOrphans

    public File[] findOrphans()
                       throws IOException

  Throws:
    `IOException`

### filesContainingLink

    public File[] filesContainingLink(URL link)

### filesContainingLinks

    public File[] filesContainingLinks(URL[] link)

### findBrokenLinks

    public URL[] findBrokenLinks()

  finds links to URLs that are not accessible

### findBrokenLocalLinks

    public File[] findBrokenLocalLinks()

  finds links to local files that do not exist

### findLinksTo

    public File[] findLinksTo(File file)
                       throws IOException

  Throws:
    `IOException`

### toFile

    public static File toFile(URL url)

  returns the canonical file or null if the URL doesn't point to a valid file

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads