B4J Library FileUtils

Discussion in 'B4J Libraries & Classes' started by PatrikCavina, Jul 17, 2018.

  1. PatrikCavina

    PatrikCavina Active Member Licensed User

    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.
     

    Attached Files:

    Last edited: Sep 14, 2018
    Star-Dust, jmon, joulongleu and 2 others like this.
  2. Mashiane

    Mashiane Expert Licensed User

    Cool, some comments are not english eish. Whilst I respect your home language, and as curious as I am, dont you want to include english descriptions for the ones that are not please? Thanks.
     
    PatrikCavina, joulongleu and Sandman like this.
  3. PatrikCavina

    PatrikCavina Active Member Licensed User

    Sorry for my laziness :oops:
    I had translate all comments in English and correct some things in source code
     
    Mashiane and joulongleu like this.
  4. Fr Simon Rundell

    Fr Simon Rundell Member Licensed User

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

    DonManfred Expert Licensed User

    PatrikCavina and Erel like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice