Package com.ngt.jopenmetaverse.shared.sim.asset

Examples of com.ngt.jopenmetaverse.shared.sim.asset.AssetTexture


          RemoveTransfer(task.Transfer.ID);
          resetEvents[task.RequestSlot].set(); // free up request slot

          for (MethodDelegate<Void, TextureDownloadCallbackArgs> callback: task.Callbacks)
            callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Timeout, new AssetTexture(task.RequestID, task.Transfer.AssetData)));

          return;
        }
      }

      // The header is downloaded, we can insert this data in to the proper position
      // Only insert if we haven't seen this packet before
      synchronized (task.Transfer)
      {
        if (!task.Transfer.PacketsSeen.containsKey(image.ImageID.Packet))
        {
          task.Transfer.PacketsSeen.put(image.ImageID.Packet, image.ImageID.Packet);
          Utils.arraycopy(image.ImageData.Data, 0, task.Transfer.AssetData,
              task.Transfer.InitialDataSize + (1000 * (image.ImageID.Packet - 1)),
              image.ImageData.Data.length);
          task.Transfer.Transferred += image.ImageData.Data.length;
        }
      }

      task.Transfer.setTimeSinceLastPacket(0);

      if (task.Transfer.Transferred >= task.Transfer.Size)
      {
        //if DEBUG_TIMING
        long stopTime = Utils.getUnixTime();
        long requestDuration = stopTime - task.StartTime;

        long networkDuration = stopTime - task.NetworkTime;

        TotalTime += requestDuration;
        NetworkTime += networkDuration;
        TotalBytes += task.Transfer.Size;

        JLogger.debug(
            String.format(
                "Transfer Complete {0} [{1}] Total Request Time: {2}, Download Time {3}, Network {4}Kb/sec, Image Size {5} bytes",
                task.RequestID, task.RequestSlot, requestDuration, networkDuration,
                Math.round(task.Transfer.Size/networkDuration/(60*60)), task.Transfer.Size));
        //endif

        task.Transfer.Success = true;
        RemoveTransfer(task.Transfer.ID);
        resetEvents[task.RequestSlot].set(); // free up request slot
        _Client.assets.Cache.saveAssetToCache(task.RequestID, task.Transfer.AssetData);
        for (MethodDelegate<Void, TextureDownloadCallbackArgs> callback: task.Callbacks)
          callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Finished, new AssetTexture(task.RequestID, task.Transfer.AssetData)));

        _Client.assets.FireImageProgressEvent(task.RequestID, task.Transfer.Transferred, task.Transfer.Size);
      }
      else
      {
        if (task.ReportProgress)
        {
          for (MethodDelegate<Void, TextureDownloadCallbackArgs> callback: task.Callbacks)
            callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Progress,
                new AssetTexture(task.RequestID, task.Transfer.AssetData)));
        }
        _Client.assets.FireImageProgressEvent(task.RequestID, task.Transfer.Transferred,
            task.Transfer.Size);
      }
    }
View Full Code Here


        resetEvents[task.RequestSlot].set();

        _Client.assets.Cache.saveAssetToCache(task.RequestID, task.Transfer.AssetData);

        for (MethodDelegate<Void, TextureDownloadCallbackArgs> callback : task.Callbacks)
          callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Finished, new AssetTexture(task.RequestID, task.Transfer.AssetData)));

        _Client.assets.FireImageProgressEvent(task.RequestID, task.Transfer.Transferred, task.Transfer.Size);
      }
      else
      {
        if (task.ReportProgress)
        {
          for (MethodDelegate<Void, TextureDownloadCallbackArgs> callback: task.Callbacks)
            callback.execute(new TextureDownloadCallbackArgs(TextureRequestState.Progress,
                new AssetTexture(task.RequestID, task.Transfer.AssetData)));
        }

        _Client.assets.FireImageProgressEvent(task.RequestID, task.Transfer.Transferred,
            task.Transfer.Size);
      }
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.sim.asset.AssetTexture

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.