edu.mit.jverbnet.util
Class ResourceUtils

java.lang.Object
  extended by edu.mit.jverbnet.util.ResourceUtils

public class ResourceUtils
extends java.lang.Object

A few utilities relating to Files and URLs.

Since:
JVerbnet 1.0.0
Version:
1.2.0
Author:
Mark A. Finlayson

Constructor Summary
ResourceUtils()
           
 
Method Summary
static java.io.File toFile(java.net.URL url)
          Transforms a URL into a File.
static java.io.File toFileChecked(java.net.URL url)
          Transforms a URL into a File.
static java.net.URL toURL(java.io.File file)
          Transforms a file into a URL.
 
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

toFileChecked

public static java.io.File toFileChecked(java.net.URL url)
                                  throws java.io.IOException
Transforms a URL into a File. The URL must use the 'file' protocol and must be in a UTF-8 compatible format as specified in URLDecoder.

Returns:
a file pointing to the same place as the url, or null if the url does not use the 'file' protocol
Throws:
java.lang.NullPointerException - if the url is null
java.io.IOException - if there is an IO problem
Since:
JVerbnet 1.0.0

toFile

public static java.io.File toFile(java.net.URL url)
                           throws java.io.IOException
Transforms a URL into a File. The URL must use the 'file' protocol and must be in a UTF-8 compatible format as specified in URLDecoder.

Returns:
a file pointing to the same place as the url
Throws:
java.lang.NullPointerException - if the url is null
java.lang.IllegalArgumentException - if the url does not use the 'file' protocol
java.io.IOException - if there is an IO problem
Since:
JVerbnet 1.0.0

toURL

public static java.net.URL toURL(java.io.File file)
Transforms a file into a URL.

Parameters:
file - the file to be transformed
Returns:
a URL representing the file
Throws:
java.lang.NullPointerException - if the specified file is null
Since:
JVerbnet 1.0.0


Copyright © 2012 ${project.organization.name}. All Rights Reserved.