What is Ferris IO

This is the Ferris IO project. The purpose of this project is to provide basic utilies around IO operations which do not exist in the JDK java.io package and do not exist in Jakarta Commons IO.

Ferris IO should stay relatively small. A lot of functionality already exists either in the JDK itself or in a Jakarta Commons package somewhere.

Examples

CanonicalFile

Many time you need to create a File object to either a directory or a file and you need to know that it exists and the operating system permissions allow read/write operations. This class is a wrapper over File which allows you do do this. Here are some examples.

// Create a CanonicalFile object to a DIRECTORY which exists, readable, and writable.
CanonicalFile cf
    = CanonicalFile.directoryInstance(new File("/etc"));
    
    
// Create a CanonicalFile object to a FILE which exists, readable, and writable.
CanonicalFile cf
    = CanonicalFile.directoryInstance(new File("/etc/hosts"));   
    

// Create a CanonicalFile object to a FILE which exists, readable, and writable.
CanonicalFile cf
    = CanonicalFile.directoryInstance(new File("/etc/hosts"));
    

// Create a CanonicalFile object to a FILE which exists, and readable.
CanonicalFile cf
    = new CanonicalFile(new File("/tmp/my-tmp-file"), CanonicalFile.Property.file,CanonicalFile.Property.exists,CanonicalFile.Property.readable);

FileSplitter

Sometimes a large file needs to be split into smaller files such that concatenating all the smaller files produces the original large file again. The purpose of this class is to do the splitting.

FileSplitterAsText fileSplitter =
    new FileSplitterAsText(
          sourceFile                 // the file to split
        , destinationDirectory       // the directory to put the smaller files
        , destinationFileBaseName    // the base name to use for the smaller files, ex "BigFile_Part_"
        , destinationFileExtension   // the extension to use for the smaller files, ex "txt"
        , destinationFileSizeInBytes // the maximum number of bytes for each smaller file. 
        , Sequence<String> sequence  // the sequence appended to destinationFileBaseName, ex [1,2,3,4...N]
    );

fileSplitter.split();