Class Methods

java.lang.Object
dev.buildtool.tools.Methods

public class Methods
extends java.lang.Object
Created on 7/12/18 by alexiy.
  • Constructor Summary

    Constructors 
    Constructor Description
    Methods()  
  • Method Summary

    Modifier and Type Method Description
    static java.nio.file.Path copyFile​(java.nio.file.Path from, java.nio.file.Path to, java.nio.file.CopyOption... copyOptions)
    Copies the file, creating parent directories in the process
    static java.nio.file.Path createFile​(java.nio.file.Path path, java.nio.file.LinkOption... linkOptions)
    Creates a file and its parent directories from path
    static java.util.HashMap<java.lang.String,​java.lang.String> createMapFrom​(java.lang.String... strings)
    Creates a map from strings in format [key:value]
    static boolean delete​(java.nio.file.Path path)
    Recursively deletes files and folders
    static java.util.List<java.nio.file.Path> getDirectories​(java.nio.file.Path from, java.util.List<java.nio.file.Path> list)
    Recursively gets all directories
    static java.util.List<java.nio.file.Path> getFiles​(java.nio.file.Path from, java.util.List<java.nio.file.Path> list)
    Recursively retrieves all files from the specified path
    static double getVisualTextWidth​(java.lang.String string)  
    static <I> java.util.List<I> newList​(I... items)  
    static java.util.List<java.lang.String> readFile​(java.nio.file.Path path)  
    static java.lang.String removeAllCharactersFrom​(java.lang.String target, java.lang.String... toRemove)
    Removes given characters from given string.
    static java.nio.file.Path write​(java.nio.file.Path path, java.lang.Iterable<? extends java.lang.CharSequence> charSequences)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • createFile

      public static java.nio.file.Path createFile​(java.nio.file.Path path, java.nio.file.LinkOption... linkOptions)
      Creates a file and its parent directories from path
      Returns:
      null if the path couldn't be created or located, otherwise the path
    • copyFile

      public static java.nio.file.Path copyFile​(java.nio.file.Path from, java.nio.file.Path to, java.nio.file.CopyOption... copyOptions)
      Copies the file, creating parent directories in the process
    • readFile

      public static java.util.List<java.lang.String> readFile​(java.nio.file.Path path)
    • write

      public static java.nio.file.Path write​(java.nio.file.Path path, java.lang.Iterable<? extends java.lang.CharSequence> charSequences)
    • delete

      public static boolean delete​(java.nio.file.Path path)
      Recursively deletes files and folders
      Parameters:
      path - file or dir
      Returns:
      true on success
    • getFiles

      public static java.util.List<java.nio.file.Path> getFiles​(java.nio.file.Path from, java.util.List<java.nio.file.Path> list)
      Recursively retrieves all files from the specified path
      Parameters:
      from - a directory
      list - list to populate with files
      Returns:
      file list
    • getDirectories

      public static java.util.List<java.nio.file.Path> getDirectories​(java.nio.file.Path from, java.util.List<java.nio.file.Path> list)
      Recursively gets all directories
    • getVisualTextWidth

      public static double getVisualTextWidth​(java.lang.String string)
    • createMapFrom

      public static java.util.HashMap<java.lang.String,​java.lang.String> createMapFrom​(java.lang.String... strings)
      Creates a map from strings in format [key:value]
    • removeAllCharactersFrom

      public static java.lang.String removeAllCharactersFrom​(java.lang.String target, java.lang.String... toRemove)
      Removes given characters from given string. Any of the strings with length > 1 will be ignored
      Parameters:
      toRemove - array of characters in string form
    • newList

      public static <I> java.util.List<I> newList​(I... items)