public class SearchPathUtil extends Object
| Constructor and Description |
|---|
SearchPathUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
findPath(String... paths)
Convenient class to find the first existing resource.
|
static byte[] |
getBytes(String... paths)
Reads bytes from resource.
|
static boolean |
isTempSystemFile(String fileName) |
static File[] |
listFiles(File dir,
String wildcardMatcher) |
static Properties |
loadProperties(String... path) |
static InputStream |
openStream(String... paths)
Searches for resources in
a) classpath or (prefix
classpath:)
b) the local file system (no prefix)
When the first resource is found, an InputStream will be returned. |
public static InputStream openStream(String... paths) throws FileNotFoundException
classpath:)
EG:
byte[] bCP = SearchPathUtil.getBytes("classpath:/html/generic/Welcome.html")
byte[] bFS = SearchPathUtil.getBytes("src/main/resources/html/generic/Welcome.html")
paths - At least one resource location which can be a location within the classpath or a the local file system.FileNotFoundExceptionpublic static byte[] getBytes(String... paths) throws IOException
paths - At least one or more locations of the resource.IOExceptionpublic static String findPath(String... paths)
paths - At least one or more locations of the resource.IllegalArgumentException - If no resource is available.public static Properties loadProperties(String... path) throws IOException
IOExceptionpublic static boolean isTempSystemFile(String fileName)
Copyright © 2016 LeanIX GmbH. All rights reserved.