Class MFileOS7

  • All Implemented Interfaces:
    Comparable<MFile>, MFile

    @ThreadSafe
    public class MFileOS7
    extends Object
    implements MFile
    Use Java 7 nio Paths
    Since:
    11/16/13
    • Method Detail

      • getExistingFile

        public static MFileOS7 getExistingFile​(String filename)
                                        throws IOException
        Make MFileOS7 if file exists, otherwise return null
        Parameters:
        filename - full path name
        Returns:
        MFileOS or null
        Throws:
        IOException
      • getLastModified

        public long getLastModified()
        Description copied from interface: MFile
        Get time of last modification at the time the MFile object was created
        Specified by:
        getLastModified in interface MFile
        Returns:
        time of last modification in Unix time (msecs since reference), or -1 if unknown
      • getLength

        public long getLength()
        Description copied from interface: MFile
        Size of file in bytes
        Specified by:
        getLength in interface MFile
        Returns:
        Size of file in bytes or -1 if unknown
      • isDirectory

        public boolean isDirectory()
        Specified by:
        isDirectory in interface MFile
      • isReadable

        public boolean isReadable()
        Specified by:
        isReadable in interface MFile
      • getPath

        public String getPath()
        Description copied from interface: MFile
        Get full path name, replace \\ with /
        Specified by:
        getPath in interface MFile
        Returns:
        full path name
      • getName

        public String getName()
        Description copied from interface: MFile
        The name is the farthest element from the root in the directory hierarchy.
        Specified by:
        getName in interface MFile
        Returns:
        the file name
      • exists

        public boolean exists()
        Description copied from interface: MFile
        Check if the MFile exists
        Specified by:
        exists in interface MFile
        Returns:
        true if the MFile exists, else false
      • writeToStream

        public void writeToStream​(OutputStream outputStream)
                           throws IOException
        Description copied from interface: MFile
        Write the MFile to an OutputStream
        Specified by:
        writeToStream in interface MFile
        Parameters:
        outputStream - the OutputStream the MFile contents should be written to
        Throws:
        IOException
      • writeToStream

        public void writeToStream​(OutputStream outputStream,
                                  long offset,
                                  long maxBytes)
                           throws IOException
        Description copied from interface: MFile
        Write the MFile to an OutputStream
        Specified by:
        writeToStream in interface MFile
        Parameters:
        outputStream - the OutputStream the MFile contents should be written to
        offset - the index of the first byte to write out
        maxBytes - the maximum number of bytes to copy
        Throws:
        IOException
      • getChild

        public MFileOS7 getChild​(String newFilename)
        Description copied from interface: MFile
        Get child MFile of this MFile
        Specified by:
        getChild in interface MFile
        Parameters:
        newFilename - the relative file path of the new MFile
        Returns:
        the new MFile or null if the file can't be resolved
      • getNioPath

        public Path getNioPath()