public class FileUtil extends Object
Constructor and Description |
---|
FileUtil() |
Modifier and Type | Method and Description |
---|---|
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.
|
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)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.