Class FileUtil

java.lang.Object
org.compiere.tools.FileUtil

public class FileUtil extends Object
File Utilities
Version:
$Id: FileUtil.java,v 1.4 2006/08/03 04:03:22 jjanke Exp $
Author:
Jorg Janke
  • Field Details

  • Constructor Details

    • FileUtil

      public FileUtil(String file, String filter, String action, String p1, String p2)
      File Utility
      Parameters:
      file - input file or directory
      filter - filter
      action - action
      p1 - parameter 1
      p2 - parameter 2
    • FileUtil

      public FileUtil(File file, String filter, String action, String p1, String p2)
      File Utility
      Parameters:
      file - input file or directory
      filter - filter
      action - action
      p1 - parameter 1
      p2 - parameter 2
  • Method Details

    • main

      public static void main(String[] args)
      Start
      Parameters:
      args - fileName filter action
    • getTempMailName

      public static String getTempMailName(String subject, String extension)
    • parseTitle

      public static String parseTitle(Properties ctx, String title, int table_ID, int record_ID, int m_WindowNo, String trxName)
      Parameters:
      title -
      table_ID -
      record_ID -
      ctx -
      m_WindowNo -
      trxName -
      Returns:
    • createTempFile

      public static File createTempFile(String prefix, String suffix, File directory) throws IOException
      Throws:
      IOException
    • getTempFolderName

      public static String getTempFolderName(File directory) throws IOException
      Generates a unique temporary folder name based on the current timestamp and session ID.
      The folder name is either within the specified directory or the default temporary directory.
      Parameters:
      directory - the base directory where the temporary folder will be created; if null, the system's default temporary directory is used
      Returns:
      a string representing the path to the unique temporary folder
      Throws:
      IOException
    • createTempFile

      public static File createTempFile(String prefix, String suffix) throws IOException
      Throws:
      IOException
    • createFile

      public static File createFile(String fileName) throws IOException
      Creates a file with the given filename.
      If the filename includes the path, the file is created as requested.
      If it only includes the name, the file is created in a thread-safe temporary folder.
      Parameters:
      fileName -
      Returns:
      file
      Throws:
      IOException
    • makePrefix

      public static String makePrefix(String name)
      Creates a valid file name prefix from "name"
      Parameters:
      name -
      Returns:
      file name prefix
    • deleteFolderRecursive

      public static boolean deleteFolderRecursive(File path) throws FileNotFoundException
      Parameters:
      path -
      Returns:
      true if deleted
      Throws:
      FileNotFoundException
    • copy

      public static void copy(MAttachment attachment, File destinationFile, int index)
      copy attachment entry to file
      Parameters:
      attachment -
      destinationFile -
      index -
    • deleteDirectory

      public static void deleteDirectory(File folder) throws IOException
      delete folder recursively
      Parameters:
      folder -
      Throws:
      IOException