B4J Library FileUtils

I hope it can be useful.
I'm using this library a lot of in my application.

It depends on:
- ByteConverter
- Encryption
- JavaObject​

FileUtils

Author: PNK
Version: 1.2
  • FileUtils
    You can set InitialFolder and initialFilterDescription before each call to a FileChooser.
    If initialFolder is not set, "user.home" of the OS will be used
    initialFolder is always setted with last opened folder
    • Fields:
      • initialFilterDescription As String
      • initialFolder As String
    • Functions:
      • ChooseFile (Frm As Form, Filters As Map, AllFilters As Boolean, MergeFilters As Boolean, MergeName As String, Title As String) As Path
        Returns uninitialized Path if a destination is not chosen
        <code> Dim filters As Map = CreateMap( Array As String("*.txt") : "TXT File", _
        Array As String("*.xml") : "XML File", _
        Array As String("*.html", "*.htm") : "Hyper Text")</code>
      • ChooseFolder (Frm As Form, Title As String, InitialDir As String) As Path
        Returns uninitialized Path if a destination is not chosen
      • ChooseMultipleFiles (Frm As Form, Filters As Map, AllFilters As Boolean, MergeFilters As Boolean, MergeName As String, Title As String) As List
        Returns uninitialized Path if a destination is not chosen
      • Combine (Path As Path) As String
      • Copy (DirSource As String, FileSource As String, DirTarget As String, FileTarget As String) As String
        Similar to File.Copy() but also folders with content can be copied
      • CopyAsync (DirSource As String, FileSource As String, DirTarget As String, FileTarget As String) As ResumableSub
        Similar to File.CopyAsync() but also folders with content can be copied
      • CreatePath (Folder As String, FileName As String) As Path
      • CreatePath2 (CompletePath As String) As Path
      • Delete (Folder As String, FileName As String) As String
        Similar to File.Delete() but also folders with content can be deleted
      • EqualFile (Source1 As String, FileName1 As String, Source2 As String, FileName2 As String, Algorithm As String) As Boolean
        Check through the checksum algorithm if two files are equal.
        Algorithm = "MD5", "SHA-1", "SHA-224", "SHA-256", "SHA-384", "SHA-512"
      • Exist (Path As Path) As Boolean
      • GetChecksum (Folder As String, FileName As String, Algorithm As String) As String
        Algorithm can be "MD5", "SHA-1", "SHA-224", "SHA-256", "SHA-384" or "SHA-512"
      • GetExtension (FileName As String) As String
        Return file extension
        Ex.
        FileUtils.GetExtension("test.txt") <---- Returns ".txt"
      • GetFiles (FolderPath As String) As List
      • GetFolders (FolderPath As String) As List
      • GetSubFolders (RootFolder As String) As List
        Return a list of all the paths of the subfolders in rootFolder.
        The list will not contain RootFolder
      • IsDirectory (Path As Path) As Boolean
      • LastModified (Path As Path) As Long
      • MakeDir (Path As Path) As String
      • OpenFile (Folder As String, FileName As String) As String
      • OpenFile2 (CompletePath As String) As String
      • Process_Globals As String
      • RemoveExtension (FileName As String) As String
        Return a new string without extension
      • RenameTo (Folder As String, FileName As String, NewFileName As String) As String
      • SaveFile (Frm As Form, Filters As Map, AllFilters As Boolean, MergeFilters As Boolean, MergeName As String, InitialFileName As String, Title As String) As Path
        Returns uninitialized Path if a destination is not chosen
      • Size (Path As Path) As Long
  • Path
    • Fields:
      • FileName As String
      • Folder As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
    • Functions:
      • Initialize
        Initializes the fields to their default value.
 

Attachments

  • FileUtilsSource.zip
    4.3 KB · Views: 697
Last edited:

Fr Simon Rundell

Member
Licensed User
Longtime User
Hello, what encryption library does this reference, as my system doesn't seem to like "messagedigest" even with jB4XEncryption v 1.00 installed.
 

DonManfred

Expert
Licensed User
Longtime User
Top