Class FileDataSource

    • Constructor Detail

      • FileDataSource

        public FileDataSource​(File file)
        Create a new FileDataSource instance. The provided file will be used for reading from and/or storing data into.
        Parameters:
        file - the file to use for reading the data from from or writing the data to
    • Method Detail

      • getFile

        public File getFile()
        Returns the file that this data source is mapped to.
        Returns:
        the file that this data source will use for reading and writing data
      • getInputStream

        public InputStream getInputStream()
                                   throws IOException
        Returns an InputStream that is able to read data from the file that was passed in when constructing the FileDataSource.
        Specified by:
        getInputStream in interface InputDataSource
        Returns:
        an InputStream that is able to read from the file
        Throws:
        IOException - when the InputStream on the file could not be created
      • getOutputStream

        public OutputStream getOutputStream()
                                     throws IOException
        Returns an OutputStream that is able to write data to the file that was passed in when constructing the FileDataSource.
        Specified by:
        getOutputStream in interface OutputDataSource
        Returns:
        an OutputStream that is able to write to the file
        Throws:
        IOException - when the OutputStream on the file could not be created