Package org.compiere.tools
Class FileUtil
java.lang.Object
org.compiere.tools.FileUtil
File Utilities
- Version:
- $Id: FileUtil.java,v 1.4 2006/08/03 04:03:22 jjanke Exp $
- Author:
- Jorg Janke
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
copy
(MAttachment attachment, File destinationFile, int index) copy attachment entry to filestatic File
createFile
(String fileName) Creates a file with the given filename.static File
createTempFile
(String prefix, String suffix) static File
createTempFile
(String prefix, String suffix, File directory) static void
deleteDirectory
(File folder) delete folder recursivelystatic boolean
deleteFolderRecursive
(File path) static String
getTempFolderName
(File directory) Generates a unique temporary folder name based on the current timestamp and session ID.static String
getTempMailName
(String subject, String extension) static void
Startstatic String
makePrefix
(String name) Creates a valid file name prefix from "name"static String
parseTitle
(Properties ctx, String title, int table_ID, int record_ID, int m_WindowNo, String trxName)
-
Field Details
-
COPYRIGHT
License Header- See Also:
-
-
Constructor Details
-
FileUtil
File Utility- Parameters:
file
- input file or directoryfilter
- filteraction
- actionp1
- parameter 1p2
- parameter 2
-
FileUtil
File Utility- Parameters:
file
- input file or directoryfilter
- filteraction
- actionp1
- parameter 1p2
- parameter 2
-
-
Method Details
-
main
Start- Parameters:
args
- fileName filter action
-
getTempMailName
-
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
- Throws:
IOException
-
getTempFolderName
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
- Throws:
IOException
-
createFile
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
Creates a valid file name prefix from "name"- Parameters:
name
-- Returns:
- file name prefix
-
deleteFolderRecursive
- Parameters:
path
-- Returns:
- true if deleted
- Throws:
FileNotFoundException
-
copy
copy attachment entry to file- Parameters:
attachment
-destinationFile
-index
-
-
deleteDirectory
delete folder recursively- Parameters:
folder
-- Throws:
IOException
-