Пример #1
0
  /**
   * 画像を取得する。
   *
   * @param entry イメージエントリ
   * @throws java.lang.InterruptedException interrupted
   */
  protected void fetchImage(FetchEntry entry) throws InterruptedException {
    synchronized (entry) {
      if (entry.isFinished()) {
        return;
      }

      byte[] imageData = NetworkSupport.fetchContents(entry.connectionInfo);
      ImageEntry imageEntry = entry.imageEntry;
      imageEntry.rawData = imageData;
      imageEntry.image = Toolkit.getDefaultToolkit().createImage(imageData);
      cachedImages.put(entry.getImageUrl(), entry.imageEntry);
      configuration.addJob(JobQueue.PRIORITY_IDLE, new ImageFlusher(imageEntry));
    }
  }
Пример #2
0
 /**
  * インスタンス生成
  *
  * @param entry フェッチエントリ
  * @throws InterruptedException コネクション確立中に割り込まれた
  */
 public ImageFetcher(FetchEntry entry) throws InterruptedException {
   this.entry = entry;
   entry.connectionInfo = NetworkSupport.openConnection(entry.url, this);
 }