Class FileTool

java.lang.Object
com.tunyk.mvn.plugins.htmlcompressor.FileTool

public class FileTool extends Object
The Class FileTool.
  • Field Details

    • rootDirPath

      private String rootDirPath
      The root dir path.
    • fileExtensions

      private String[] fileExtensions
      The file extensions.
    • recursive

      private boolean recursive
      The recursive.
    • fileEncoding

      private Charset fileEncoding
      The file encoding.
  • Constructor Details

    • FileTool

      public FileTool(String rootDir, String[] fileExtensions, boolean recursive) throws IOException
      Instantiates a new file tool.
      Parameters:
      rootDir - the root dir
      fileExtensions - the file ext
      recursive - the recursive
      Throws:
      IOException - Signals that an I/O exception has occurred.
  • Method Details

    • getFiles

      public ConcurrentMap<String,String> getFiles() throws IOException
      Gets the files.
      Returns:
      the files
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • writeFiles

      public void writeFiles(Map<String,String> map, String targetDir) throws IOException
      Write files.
      Parameters:
      map - the map
      targetDir - the target dir
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • writeToJsonFile

      public void writeToJsonFile(Map<String,String> map, String targetFile, String integrationCode) throws IOException, org.json.JSONException
      Write to json file.
      Parameters:
      map - the map
      targetFile - the target file
      integrationCode - the integration code
      Throws:
      IOException - Signals that an I/O exception has occurred.
      org.json.JSONException - the JSON exception
    • humanReadableByteCount

      public static String humanReadableByteCount(long bytes, boolean systemOfUnits)
      Human readable byte count.
      Parameters:
      bytes - the bytes
      systemOfUnits - the systemOfUnits
      Returns:
      the string
    • getElapsedHMSTime

      public static String getElapsedHMSTime(long elapsedTime)
      Gets the elapsed HMS time.
      Parameters:
      elapsedTime - the elapsed time
      Returns:
      the elapsed HMS time
    • getRootDirPath

      public String getRootDirPath()
      Gets the root dir path.
      Returns:
      the root dir path
    • setRootDirPath

      public void setRootDirPath(String rootDirPath) throws IOException
      Sets the root dir path.
      Parameters:
      rootDirPath - the new root dir path
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getFileExtensions

      public String[] getFileExtensions()
      Gets the file extensions.
      Returns:
      the file extensions
    • setFileExtensions

      public void setFileExtensions(String[] fileExtensions)
      Sets the file extensions.
      Parameters:
      fileExtensions - the new file extensions
    • isRecursive

      public boolean isRecursive()
      Checks if is recursive.
      Returns:
      true, if is recursive
    • setRecursive

      public void setRecursive(boolean recursive)
      Sets the recursive.
      Parameters:
      recursive - the new recursive
    • getFileEncoding

      public Charset getFileEncoding()
      Gets the file encoding.
      Returns:
      the file encoding
    • setFileEncoding

      public void setFileEncoding(Charset fileEncoding)
      Sets the file encoding.
      Parameters:
      fileEncoding - the new file encoding