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 void closeSilently​(java.io.Closeable closeable)
    Close a closeable object quietly, added because such method in APACHE-IO has been deprecated
    static java.lang.String makeOsFilePathWithoutDuplications​(java.io.File[] files)
    Make file path appropriate for current OS.
    static java.lang.String makeOsFilePathWithoutDuplications​(java.lang.String... paths)
    Make file path from provided strings
    static int printTextProgressBar​(java.lang.String text, long value, long maxValue, int progressBarWidth, int lastValue)
    Print text progress bar.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 bar
      value - value to be rendered
      maxValue - max value to be rendered
      progressBarWidth - width of bar
      lastValue - 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