public class IOUtils
extends java.lang.Object
| Constructor and Description |
|---|
IOUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.io.InputStream |
catchForbidden(@NotNull java.net.URL url)
A trick to avoid some forbidden response.
|
static void |
copy(@NotNull fr.flowarg.flowlogger.ILogger logger,
@NotNull java.nio.file.Path in,
@NotNull java.nio.file.Path out)
Copy a local file to a destination file.
|
static void |
download(@NotNull fr.flowarg.flowlogger.ILogger logger,
@NotNull java.net.URL in,
@NotNull java.nio.file.Path out)
Download a remote file to a destination file.
|
static <T> void |
executeAsyncForEach(@NotNull java.lang.Iterable<T> iterable,
@NotNull java.util.concurrent.ExecutorService service,
java.util.function.Consumer<T> runnable)
Execute asynchronously a task for a collection of items.
|
static @NotNull java.lang.String |
getContent(java.io.InputStream remote)
Get the content from a remote stream.
|
static @NotNull java.lang.String |
getContent(java.net.URL url)
Get the content from a remote url.
|
static java.lang.String |
getLatestArtifactVersion(@NotNull org.w3c.dom.Document doc) |
static @Nullable java.lang.String |
getLatestArtifactVersion(java.lang.String mavenMetadataUrl) |
static java.nio.file.Path |
getMinecraftFolder()
Retrieve the local Minecraft folder path.
|
static com.google.gson.JsonElement |
readJson(java.io.InputStream inputStream)
Reading an inputStream in a json element
|
static com.google.gson.JsonElement |
readJson(java.net.URL jsonURL)
Reading an url in a json element
|
public static void download(@NotNull
@NotNull fr.flowarg.flowlogger.ILogger logger,
@NotNull
@NotNull java.net.URL in,
@NotNull
@NotNull java.nio.file.Path out)
logger - a valid logger instance.in - the input url.out - the output file.public static void copy(@NotNull
@NotNull fr.flowarg.flowlogger.ILogger logger,
@NotNull
@NotNull java.nio.file.Path in,
@NotNull
@NotNull java.nio.file.Path out)
logger - a valid logger instance.in - the input file.out - the output file.@NotNull public static @NotNull java.lang.String getContent(java.net.URL url)
url - the destination url@NotNull public static @NotNull java.lang.String getContent(java.io.InputStream remote)
remote - the remote streampublic static com.google.gson.JsonElement readJson(java.net.URL jsonURL)
jsonURL - json inputpublic static com.google.gson.JsonElement readJson(java.io.InputStream inputStream)
inputStream - json inputpublic static java.io.InputStream catchForbidden(@NotNull
@NotNull java.net.URL url)
throws java.lang.Exception
url - the destination url.java.lang.Exception - if an I/O error occurred.public static <T> void executeAsyncForEach(@NotNull
@NotNull java.lang.Iterable<T> iterable,
@NotNull
@NotNull java.util.concurrent.ExecutorService service,
java.util.function.Consumer<T> runnable)
T - the type of the items.iterable - the collection of items.service - the executor service.runnable - the task to execute.@Nullable public static @Nullable java.lang.String getLatestArtifactVersion(java.lang.String mavenMetadataUrl)
public static java.lang.String getLatestArtifactVersion(@NotNull
@NotNull org.w3c.dom.Document doc)
public static java.nio.file.Path getMinecraftFolder()