Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.errai.reflections.vfs
Class Vfs

    java.lang.Object
      org.jboss.errai.reflections.vfs.Vfs

    public abstract class Vfs

extends java.lang.Object

a simple virtual file system bridge

use the `fromURL(java.net.URL)` to get a `Vfs.Dir` and than use `Vfs.Dir.getFiles()` to iterate over it's `Vfs.File`

for example:

          Vfs.Dir dir = Vfs.fromURL(url);
          Iterable files = dir.getFiles();
          for (Vfs.File file : files) {
              InputStream is = file.openInputStream();
          }

use `findFiles(java.util.Collection, com.google.common.base.Predicate)` to get an iteration of files matching given name predicate over given list of urls

`fromURL(java.net.URL)` uses static `Vfs.DefaultUrlTypes` to resolves URLs and it can be plugged in with `addDefaultURLTypes(org.jboss.errai.reflections.vfs.Vfs.UrlType)` or `setDefaultURLTypes(java.util.List)`.

for example:

          Vfs.addDefaultURLTypes(new Vfs.UrlType() {
              public boolean matches(URL url)         {
                  return url.getProtocol().equals("http");
              }
              public Vfs.Dir createDir(final URL url) {
                  return new HttpDir(url); //implement this type... (check out a naive implementation on VfsTest)
              }
          });

          Vfs.Dir dir = Vfs.fromURL(new URL("http://mirrors.ibiblio.org/pub/mirrors/maven2/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar"));

Nested Class Summary
`static class` | `Vfs.DefaultUrlTypes` default url types used by `fromURL(java.net.URL)`
`static interface` | `Vfs.Dir` an abstract vfs dir
`static interface` | `Vfs.File` an abstract vfs file
`static interface` | `Vfs.UrlType` a matcher and factory for a url

Constructor Summary
`Vfs()`

Method Summary
`static void` | `addDefaultURLTypes(Vfs.UrlType urlType)` add a static default url types.
`static java.lang.Iterable<Vfs.File>` | `findFiles(java.util.Collection<java.net.URL> inUrls, com.google.common.base.Predicate<Vfs.File> filePredicate)` return an iterable of all `Vfs.File` in given urls, matching filePredicate
`static java.lang.Iterable<Vfs.File>` | `findFiles(java.util.Collection<java.net.URL> inUrls, java.lang.String packagePrefix, com.google.common.base.Predicate<java.lang.String> nameFilter)` return an iterable of all `Vfs.File` in given urls, starting with given packagePrefix and matching nameFilter
`static Vfs.Dir` | `fromURL(java.net.URL url)` tries to create a Dir from the given url, using the defaultUrlTypes
`static Vfs.Dir` | `fromURL(java.net.URL url, java.util.List<Vfs.UrlType> urlTypes)` tries to create a Dir from the given url, using the given urlTypes
`static Vfs.Dir` | `fromURL(java.net.URL url, Vfs.UrlType... urlTypes)` tries to create a Dir from the given url, using the given urlTypes
`static java.util.List<Vfs.UrlType>` | `getDefaultUrlTypes()` the default url types that will be used when issuing `fromURL(java.net.URL)`
`static java.lang.String` | `normalizePath(java.net.URL url)`
`static void` | `setDefaultURLTypes(java.util.List<Vfs.UrlType> urlTypes)` sets the static default url types.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Vfs

    public Vfs()

Method Detail

### getDefaultUrlTypes

    public static java.util.List<Vfs.UrlType> getDefaultUrlTypes()

  the default url types that will be used when issuing `fromURL(java.net.URL)`

### setDefaultURLTypes

    public static void setDefaultURLTypes(java.util.List<Vfs.UrlType> urlTypes)

  sets the static default url types. can be used to statically plug in urlTypes

### addDefaultURLTypes

    public static void addDefaultURLTypes(Vfs.UrlType urlType)

  add a static default url types. can be used to statically plug in urlTypes

### fromURL

    public static Vfs.Dir fromURL(java.net.URL url)

  tries to create a Dir from the given url, using the defaultUrlTypes

### fromURL

    public static Vfs.Dir fromURL(java.net.URL url,
                                  java.util.List<Vfs.UrlType> urlTypes)

  tries to create a Dir from the given url, using the given urlTypes

### fromURL

    public static Vfs.Dir fromURL(java.net.URL url,
                                  Vfs.UrlType... urlTypes)

  tries to create a Dir from the given url, using the given urlTypes

### findFiles

    public static java.lang.Iterable<Vfs.File> findFiles(java.util.Collection<java.net.URL> inUrls,
                                                         com.google.common.base.Predicate<Vfs.File> filePredicate)

  return an iterable of all `Vfs.File` in given urls, matching filePredicate

### findFiles

    public static java.lang.Iterable<Vfs.File> findFiles(java.util.Collection<java.net.URL> inUrls,
                                                         java.lang.String packagePrefix,
                                                         com.google.common.base.Predicate<java.lang.String> nameFilter)

  return an iterable of all `Vfs.File` in given urls, starting with given packagePrefix and matching nameFilter

### normalizePath

    public static java.lang.String normalizePath(java.net.URL url)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.