Class Tailer.TailablePath

  • All Implemented Interfaces:
    Tailer.Tailable
    Enclosing class:
    Tailer

    private static final class Tailer.TailablePath
    extends java.lang.Object
    implements Tailer.Tailable
    A tailable for a file Path.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.file.LinkOption[] linkOptions  
      private java.nio.file.Path path  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TailablePath​(java.nio.file.Path path, java.nio.file.LinkOption... linkOptions)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) java.nio.file.Path getPath()  
      Tailer.RandomAccessResourceBridge getRandomAccess​(java.lang.String mode)
      Creates a random access file stream to read.
      boolean isNewer​(java.nio.file.attribute.FileTime fileTime)
      Tests if this tailable is newer than the specified FileTime.
      java.nio.file.attribute.FileTime lastModifiedFileTime()
      Gets the last modification FileTime.
      long size()
      Gets the size of this tailable.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • path

        private final java.nio.file.Path path
      • linkOptions

        private final java.nio.file.LinkOption[] linkOptions
    • Constructor Detail

      • TailablePath

        private TailablePath​(java.nio.file.Path path,
                             java.nio.file.LinkOption... linkOptions)
    • Method Detail

      • getPath

        java.nio.file.Path getPath()
      • getRandomAccess

        public Tailer.RandomAccessResourceBridge getRandomAccess​(java.lang.String mode)
                                                          throws java.io.FileNotFoundException
        Description copied from interface: Tailer.Tailable
        Creates a random access file stream to read.
        Specified by:
        getRandomAccess in interface Tailer.Tailable
        Parameters:
        mode - the access mode, by default this is for RandomAccessFile.
        Returns:
        a random access file stream to read.
        Throws:
        java.io.FileNotFoundException - if the tailable object does not exist.
      • isNewer

        public boolean isNewer​(java.nio.file.attribute.FileTime fileTime)
                        throws java.io.IOException
        Description copied from interface: Tailer.Tailable
        Tests if this tailable is newer than the specified FileTime.
        Specified by:
        isNewer in interface Tailer.Tailable
        Parameters:
        fileTime - the file time reference.
        Returns:
        true if the File exists and has been modified after the given FileTime.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • lastModifiedFileTime

        public java.nio.file.attribute.FileTime lastModifiedFileTime()
                                                              throws java.io.IOException
        Description copied from interface: Tailer.Tailable
        Gets the last modification FileTime.
        Specified by:
        lastModifiedFileTime in interface Tailer.Tailable
        Returns:
        See Files.getLastModifiedTime(Path, LinkOption...).
        Throws:
        java.io.IOException - if an I/O error occurs.
      • size

        public long size()
                  throws java.io.IOException
        Description copied from interface: Tailer.Tailable
        Gets the size of this tailable.
        Specified by:
        size in interface Tailer.Tailable
        Returns:
        The size, in bytes, of this tailable, or 0 if the file does not exist. Some operating systems may return 0 for path names denoting system-dependent entities such as devices or pipes.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object