Package io.micronaut.core.io
Class IOUtils
java.lang.Object
io.micronaut.core.io.IOUtils
Utility methods for I/O operations.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Iterates over each directory in a JAR or file system.static void
Iterates over each directory in a JAR or file system.getResources
(ClassLoader classLoader, String path) Find all the resources starting with the path.static String
readText
(BufferedReader reader) Read the content of the BufferedReader and return it as a String in a blocking manner.Resolve the path in the URI.
-
Constructor Details
-
IOUtils
public IOUtils()
-
-
Method Details
-
eachFile
public static void eachFile(@NonNull @NonNull URL url, String path, @NonNull @NonNull Consumer<Path> consumer) Iterates over each directory in a JAR or file system.- Parameters:
url
- The URLpath
- The pathconsumer
- The consumer- Since:
- 3.5.0
-
eachFile
public static void eachFile(@NonNull @NonNull URI uri, String path, @NonNull @NonNull Consumer<Path> consumer) Iterates over each directory in a JAR or file system.- Parameters:
uri
- The URIpath
- The pathconsumer
- The consumer- Since:
- 3.5.0
-
resolvePath
@Nullable public static @Nullable Path resolvePath(@NonNull @NonNull URI uri, @NonNull @NonNull String path, @NonNull @NonNull List<Closeable> toClose) throws IOException Resolve the path in the URI.- Parameters:
uri
- The URIpath
- The pathtoClose
- to close hooks- Returns:
- The path resolved
- Throws:
IOException
- Since:
- 4.7
-
readText
Read the content of the BufferedReader and return it as a String in a blocking manner. The BufferedReader is closed afterward.- Parameters:
reader
- a BufferedReader whose content we want to read- Returns:
- a String containing the content of the buffered reader
- Throws:
IOException
- if an IOException occurs.- Since:
- 1.0
-
getResources
Find all the resources starting with the path.- Parameters:
classLoader
- The classloaderpath
- The path- Returns:
- the resources as URIs
- Throws:
IOException
- The IO exception- Since:
- 4.7
-