Class FileSource

    • Field Detail

      • file

        private final java.io.File file
    • Constructor Detail

      • FileSource

        private FileSource​(java.io.File file)
      • FileSource

        private FileSource​(java.io.File file,
                           FilePosition filePosition)
    • Method Detail

      • from

        public static FileSource from​(java.io.File file)
        Create a new FileSource using the supplied file.
        Parameters:
        file - the source file; must not be null
      • from

        public static FileSource from​(java.io.File file,
                                      FilePosition filePosition)
        Create a new FileSource using the supplied file and filePosition.
        Parameters:
        file - the source file; must not be null
        filePosition - the position in the source file; may be null
        See Also:
        withPosition(FilePosition)
      • getUri

        public final java.net.URI getUri()
        Get the URI for the source file.
        Specified by:
        getUri in interface UriSource
        Returns:
        the source URI; never null
      • getFile

        public final java.io.File getFile()
        Get the source file.
        Specified by:
        getFile in interface FileSystemSource
        Returns:
        the source file; never null
      • withPosition

        @API(status=EXPERIMENTAL,
             since="1.14")
        public FileSource withPosition​(FilePosition filePosition)
        {@return a {@code FileSource} based on this instance but with the supplied {@link FilePosition}}

        If the supplied FilePosition equals the existing one, this method returns this. Otherwise, a new instance is created and returned.

        Calling this method rather than creating a new FileSource via from(File, FilePosition) avoids the overhead of redundant canonical path resolution.

        Parameters:
        filePosition - the position in the source file; may be null
        Since:
        1.14
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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