org.kuali.maven.common
Class ResourceUtils

java.lang.Object
  extended by org.kuali.maven.common.ResourceUtils

public class ResourceUtils
extends Object


Constructor Summary
ResourceUtils()
           
 
Method Summary
 void copy(String location, File file)
          Copy a URL location to the local file system
 boolean exists(String location)
           
 String getFilename(String location)
          Return a filename for this resource, i.e.
 InputStream getInputStream(String location)
          Given a location that can represent either a file on the file system or a Spring style resource, return an InputStream.
 List<String> read(List<String> locations)
           
 String read(String location)
          Read the contents of the URL location into a string
 void write(File file, String contents)
          Write the string to the file system
 
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

getInputStream

public InputStream getInputStream(String location)
                           throws IOException
Given a location that can represent either a file on the file system or a Spring style resource, return an InputStream. The method checks the file system first. If no file exists, it uses Spring resource loading to obtain an InputStream

Throws:
IOException

exists

public boolean exists(String location)

copy

public void copy(String location,
                 File file)
          throws IOException
Copy a URL location to the local file system

Throws:
IOException

write

public void write(File file,
                  String contents)
           throws IOException
Write the string to the file system

Throws:
IOException

read

public List<String> read(List<String> locations)
                  throws IOException
Throws:
IOException

read

public String read(String location)
            throws IOException
Read the contents of the URL location into a string

Throws:
IOException

getFilename

public String getFilename(String location)
                   throws IOException
Return a filename for this resource, i.e. typically the last part of the path: for example, "myfile.txt".

Throws:
IOException


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.