Class FileSource

  • All Implemented Interfaces:
    Source

    public class FileSource
    extends SourceImpl
    A Source which uses a file as input.
    • Constructor Detail

      • FileSource

        public FileSource​(StreamSourceFormat format,
                          File path,
                          ControllerState controllerState)
        Constructor.
        Parameters:
        format - the source format, not null.
        path - the path to the file to read, not null.
        controllerState - the controller state, not null.
        Throws:
        NullPointerException - if path or format is null.
    • Method Detail

      • getSourceFormat

        public StreamSourceFormat getSourceFormat()
        Returns the format of the source.
        Returns:
        the source format, not null.
      • getPath

        public File getPath()
        Returns the path to the source file.
        Returns:
        the path to the source file, not null.
      • getDescription

        public String getDescription()
        Returns the path of the file as a description.
        Returns:
        path of the file, not null.
        See Also:
        Source.getDescription()
      • getSourceFile

        public File getSourceFile()
        Returns the source file, if it exists.
        Returns:
        the source file, or null if the source is not read from a file.
      • getLastModified

        public Date getLastModified()
        Returns the date when the source was last modified.
        Returns:
        the last modification date, or null when unknown.
      • getContentChecksum

        public byte[] getContentChecksum()
        Returns the checksum of the content.
        Returns:
        the md5 sum of the content, or null if the implementation does not support creating the checksum, or if the source is unread and reading the source fails.