edu.mit.jverbnet.util
Class ResourceUtils

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

public class ResourceUtils
extends Object

A few utilities relating to Files and URLs.

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

Constructor Summary
ResourceUtils()
           
 
Method Summary
static File toFile(URL url)
          Transforms a URL into a File.
static File toFileChecked(URL url)
          Transforms a URL into a File.
static URL toURL(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 File toFileChecked(URL url)
                          throws 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:
NullPointerException - if the url is null
IOException - if there is an IO problem
Since:
JVerbnet 1.0.0

toFile

public static File toFile(URL url)
                   throws 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:
NullPointerException - if the url is null
IllegalArgumentException - if the url does not use the 'file' protocol
IOException - if there is an IO problem
Since:
JVerbnet 1.0.0

toURL

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

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


Copyright © 2012 Massachusetts Institute of Technology. All Rights Reserved.