Class UrlDataFile

java.lang.Object
org.fastnate.data.files.UrlDataFile
All Implemented Interfaces:
DataFile

public class UrlDataFile extends Object implements DataFile
Represents a data file from an URL.
Author:
Tobias Liefke
  • Constructor Details

    • UrlDataFile

      public UrlDataFile(URL url)
      Creates a new file from an URL without information about the parent folder.
      Parameters:
      url - the URL of the file we represent
    • UrlDataFile

      public UrlDataFile(DataFolder folder, URL url)
      Creates a new UrlDataFile instance.
      Parameters:
      folder - The parent folder, if any.
      url - The represented file as URL.
  • Method Details

    • getName

      public String getName()
      Description copied from interface: DataFile
      The name of this file.
      Specified by:
      getName in interface DataFile
      Returns:
      the name of this file
    • open

      public InputStream open() throws IOException
      Description copied from interface: DataFile
      Opens this file for input. The caller is responsible to close the stream.
      Specified by:
      open in interface DataFile
      Returns:
      the input stream of this file
      Throws:
      IOException - if the file is not accessible
    • getFolder

      public DataFolder getFolder()
      The parent folder, if any.
      Specified by:
      getFolder in interface DataFile
      Returns:
      the folder
    • getUrl

      public URL getUrl()
      The represented file as URL.