Class ResourceDownloader<C>

java.lang.Object
java.lang.Thread
io.sf.carte.doc.agent.net.ResourceDownloader<C>
All Implemented Interfaces:
Runnable

public abstract class ResourceDownloader<C> extends Thread
Asynchronous downloading of an embedded resource of a given type.
  • Field Details

  • Constructor Details

  • Method Details

    • getURL

      public URL getURL()
    • addListener

      public void addListener(DownloadListener<C> listener)
    • isDone

      public boolean isDone()
    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • openStream

      protected InputStream openStream() throws IOException
      Throws:
      IOException
    • getContentType

      public String getContentType()
    • readContent

      protected abstract void readContent(InputStream is) throws IOException
      Reads content from a stream and transforms it to native content.
      Parameters:
      is - the stream with the content.
      Throws:
      IOException - if an error occurs when reading the stream.
    • getResourceAgent

      protected abstract ResourceAgent<C,?> getResourceAgent()
    • notifyDownload

      protected void notifyDownload()
    • notifyFailure

      protected void notifyFailure(Exception e)
    • getNativeContent

      public C getNativeContent()