|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjsky.util.FileUtil
public class FileUtil
Contains static utility methods for dealing with files and URLs.
Constructor Summary | |
---|---|
FileUtil()
|
Method Summary | |
---|---|
static void |
copy(InputStream in,
OutputStream out)
Copy the given input stream to the given output stream. |
static String |
getSuffix(String filename)
Return the suffix of a file. |
static String |
getURL(URL url)
Return the contents of the URL as a String |
static void |
main(String[] args)
test main |
static URL |
makeURL(URL context,
String fileOrUrlStr)
Given a URL context (for resolving relative path names) and a string, which may be either a file or a URL string, return a new URL made from the string. |
static InputStream |
makeURLStream(URL url)
This method returns an InputStream for the given URL, and also wraps it in a BufferedInputStream, if necessary. |
static InputStream |
makeURLStream(URL context,
String fileOrUrlStr)
Given a URL context (for resolving relative path names) and a string, which may be either a file or a URL string, return a new InputStream by creating the URL and opening it for reading. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileUtil()
Method Detail |
---|
public static URL makeURL(URL context, String fileOrUrlStr)
context
- the base URL, used to resolve relative path names (may be null)fileOrUrlStr
- a file name or URL string (may be relative)public static InputStream makeURLStream(URL url)
url
- the URL to readpublic static InputStream makeURLStream(URL context, String fileOrUrlStr)
context
- the base URL, used to resolve relative path namesfileOrUrlStr
- a file name or URL string (may be relative)public static void copy(InputStream in, OutputStream out) throws IOException
IOException
public static String getURL(URL url) throws IOException
IOException
public static String getSuffix(String filename)
public static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |