public class IOUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
expandDirectoryPath(String path)
Expands directory path, replacing known values like java.io.tmpdir
w/ their values.
|
static String |
expandFilePath(String path)
Expands a file or directory path, replacing known values like java.io.tmpdir
w/ their values.
|
static String |
getResourceAsString(String path,
Charset encoding)
Retrieve a String from a classpath resource.
|
static String |
getUTF8ResourceAsString(String path)
Retrieve a String from an UTF-8 encoded classpath resource.
|
static String |
toString(InputStream input,
Charset encoding)
Build a String from the content on an InputStream using the encoding provided.
|
public static String getUTF8ResourceAsString(String path) throws IOException
path - location on the classpath.IOException - when the resource cannot be loaded.public static String getResourceAsString(String path, Charset encoding) throws IOException
path - location on the classpath.IOException - when the resource cannot be loaded.public static String toString(InputStream input, Charset encoding) throws IOException
input - Stream containing the data to extract.encoding - Charset used to read the input.IOException - when the resource cannot be read.public static String expandDirectoryPath(String path)
path - directory path to expand if needed.public static String expandFilePath(String path)
path - path to expand if needed.Copyright © 2022. All rights reserved.