Package com.igormaznitsa.mvngolang.utils
Class IOUtils
java.lang.Object
com.igormaznitsa.mvngolang.utils.IOUtils
public final class IOUtils
extends java.lang.Object
Auxiliary class to collect methods for work with IO.
- Since:
- 2.1.7
-
Method Summary
Modifier and Type Method Description static voidcloseSilently(java.io.Closeable closeable)Close a closeable object quietly, added because such method in APACHE-IO has been deprecatedstatic java.lang.StringmakeOsFilePathWithoutDuplications(java.io.File[] files)Make file path appropriate for current OS.static java.lang.StringmakeOsFilePathWithoutDuplications(java.lang.String... paths)Make file path from provided stringsstatic intprintTextProgressBar(java.lang.String text, long value, long maxValue, int progressBarWidth, int lastValue)Print text progress bar.
-
Method Details
-
printTextProgressBar
public static int printTextProgressBar(@Nonnull java.lang.String text, long value, long maxValue, int progressBarWidth, int lastValue)Print text progress bar.- Parameters:
text- title of the barvalue- value to be renderedmaxValue- max value to be renderedprogressBarWidth- width of barlastValue- value which was rendered last time, if the same then it will not be rendered- Returns:
- rendered value
- Since:
- 2.3.0
-
makeOsFilePathWithoutDuplications
@Nonnull public static java.lang.String makeOsFilePathWithoutDuplications(@Nonnull @MayContainNull java.io.File[] files)Make file path appropriate for current OS.- Parameters:
files- files which will be added in the path- Returns:
- joined file path with OS file separator
- Since:
- 2.1.7
-
makeOsFilePathWithoutDuplications
@Nonnull public static java.lang.String makeOsFilePathWithoutDuplications(@Nonnull @MayContainNull java.lang.String... paths)Make file path from provided strings- Parameters:
paths- path elements- Returns:
- joined file path with OS file separator
- Since:
- 2.1.7
-
closeSilently
public static void closeSilently(@Nullable java.io.Closeable closeable)Close a closeable object quietly, added because such method in APACHE-IO has been deprecated- Parameters:
closeable- object to be closed
-