com.agimatec.commons.util
Class ResourceUtils

java.lang.Object
  extended by com.agimatec.commons.util.ResourceUtils

public class ResourceUtils
extends java.lang.Object

Description:
User: roman.stumm
Date: 29.03.2010
Time: 11:23:03
viaboxx GmbH, 2010


Constructor Summary
ResourceUtils()
           
 
Method Summary
static java.util.Collection<java.lang.String> getResources(java.lang.String resourceDir)
           
static java.util.Collection<java.lang.String> getURLResources(java.net.URL dirURL)
          Reads the URL contents into a list, can read jars (jar:file:path!
static java.util.List<java.lang.String> readLines(java.io.BufferedReader reader)
          Reads the reader into a list of Strings, with one entry for each line.
static java.util.List<java.lang.String> readLines(java.net.URL url)
          Reads the URL contents into a list, with one element for each line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceUtils

public ResourceUtils()
Method Detail

readLines

public static java.util.List<java.lang.String> readLines(java.net.URL url)
                                                  throws java.io.IOException
Reads the URL contents into a list, with one element for each line.

Parameters:
url - a URL
Returns:
a List of lines
Throws:
java.io.IOException - if an IOException occurs.
Since:
1.6.8

readLines

public static java.util.List<java.lang.String> readLines(java.io.BufferedReader reader)
                                                  throws java.io.IOException
Reads the reader into a list of Strings, with one entry for each line. The reader is closed before this method returns.

Parameters:
reader - a Reader
Returns:
a List of lines
Throws:
java.io.IOException - if an IOException occurs.
Since:
1.0

getResources

public static java.util.Collection<java.lang.String> getResources(java.lang.String resourceDir)
                                                           throws java.io.IOException
Throws:
java.io.IOException

getURLResources

public static java.util.Collection<java.lang.String> getURLResources(java.net.URL dirURL)
                                                              throws java.io.IOException
Reads the URL contents into a list, can read jars (jar:file:path!package) and directories (file:path/package)

Parameters:
dirURL - a URL (a jar or file)
Returns:
a List or Set of lines
Throws:
java.io.IOException - if an IOException occurs.


Copyright © 2008-2012. All Rights Reserved.