Class FileTreeIterator.FileEntry

    • Constructor Summary

      Constructors 
      Constructor Description
      FileEntry​(java.io.File f, FS fs)
      Create a new file entry.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.File getFile()
      Get the underlying file of this entry.
      long getLastModified()
      Get the last modified time of this entry.
      long getLength()
      Get the byte length of this entry.
      FileMode getMode()
      Get the type of this entry.
      java.lang.String getName()
      Get the name of this entry within its directory.
      java.io.InputStream openInputStream()
      Obtain an input stream to read the file content.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FileEntry

        public FileEntry​(java.io.File f,
                         FS fs)
        Create a new file entry.
        Parameters:
        f - file
        fs - file system
    • Method Detail

      • getMode

        public FileMode getMode()
        Description copied from class: WorkingTreeIterator.Entry
        Get the type of this entry.

        Note: Efficient implementation required.

        The implementation of this method must be efficient. If a subclass needs to compute the value they should cache the reference within an instance member instead.

        Specified by:
        getMode in class WorkingTreeIterator.Entry
        Returns:
        a file mode constant from FileMode.
      • getName

        public java.lang.String getName()
        Description copied from class: WorkingTreeIterator.Entry
        Get the name of this entry within its directory.

        Efficient implementations are not required. The caller will obtain the name only once and cache it once obtained.

        Specified by:
        getName in class WorkingTreeIterator.Entry
        Returns:
        name of the entry.
      • getLength

        public long getLength()
        Description copied from class: WorkingTreeIterator.Entry
        Get the byte length of this entry.

        Note: Efficient implementation required.

        The implementation of this method must be efficient. If a subclass needs to compute the value they should cache the reference within an instance member instead.

        Specified by:
        getLength in class WorkingTreeIterator.Entry
        Returns:
        size of this file, in bytes.
      • getLastModified

        public long getLastModified()
        Description copied from class: WorkingTreeIterator.Entry
        Get the last modified time of this entry.

        Note: Efficient implementation required.

        The implementation of this method must be efficient. If a subclass needs to compute the value they should cache the reference within an instance member instead.

        Specified by:
        getLastModified in class WorkingTreeIterator.Entry
        Returns:
        time since the epoch (in ms) of the last change.
      • openInputStream

        public java.io.InputStream openInputStream()
                                            throws java.io.IOException
        Description copied from class: WorkingTreeIterator.Entry
        Obtain an input stream to read the file content.

        Efficient implementations are not required. The caller will usually obtain the stream only once per entry, if at all.

        The input stream should not use buffering if the implementation can avoid it. The caller will buffer as necessary to perform efficient block IO operations.

        The caller will close the stream once complete.

        Specified by:
        openInputStream in class WorkingTreeIterator.Entry
        Returns:
        a stream to read from the file.
        Throws:
        java.io.IOException - the file could not be opened for reading.
      • getFile

        public java.io.File getFile()
        Get the underlying file of this entry.
        Returns:
        the underlying file of this entry