org.webbitserver.helpers
Class ClassloaderResourceHelper

java.lang.Object
  extended by org.webbitserver.helpers.ClassloaderResourceHelper

public class ClassloaderResourceHelper
extends Object


Constructor Summary
ClassloaderResourceHelper()
           
 
Method Summary
static Iterable<FileEntry> fileEntriesFor(File[] files)
           
static Iterable<FileEntry> listFilesRelativeToClass(Class<?> clazz, String subdirectory)
          Lists all files and directories relative to the classpath entry (jar or folder) containing clazz, directly under subdirectory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassloaderResourceHelper

public ClassloaderResourceHelper()
Method Detail

listFilesRelativeToClass

public static Iterable<FileEntry> listFilesRelativeToClass(Class<?> clazz,
                                                           String subdirectory)
                                                    throws IOException
Lists all files and directories relative to the classpath entry (jar or folder) containing clazz, directly under subdirectory.

If clazz org.webbitserver.Foo is in folder /some/path/org/webbitserver/Foo.clazz, will list files in /some/path/$subdirectory
If clazz org.webbitserver.Foo is in jar /some/path/webbit.jar, will list files in /some/path/webbit.jar:$subdirectory

Parameters:
clazz - Any class within the classpath entry to be listed.
subdirectory - Subdirectory to list. Must be an absolute path, relative to the top level of the classpath entry.
Returns:
List of files directly in subdirectory, under the classpath entry containing clazz.
Throws:
IOException

fileEntriesFor

public static Iterable<FileEntry> fileEntriesFor(File[] files)


Copyright © 2012. All Rights Reserved.