Package org.gudy.azureus2.core3.util

Examples of org.gudy.azureus2.core3.util.ByteArrayHashMap


  // @see org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloaderListener#completed(org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloader, java.io.InputStream)
  public boolean completed(ResourceDownloader downloader, InputStream data) {
    downloader.removeListener(this);
    if (!nextUpdate()) {
      // fire in another thread so completed function can exit
      AEThread thread = new AEThread("AllDownloadsComplete", true) {
        public void runSupport() {
          allDownloadsComplete();
        }
      };
      thread.start();
    }
    return true;
  }
View Full Code Here


      new Listener()
      {
        public void
        handleEvent(Event event)
        {
          new AEThread2("GenerateNetDiag", true)
          {
            public void run() {
              StringWriter sw = new StringWriter();
             
              PrintWriter  pw = new PrintWriter( sw );
View Full Code Here

    progress.setLayoutData( data );
   
    parent.layout( true, true );
   
    new AEThread2( "SimpleInstallerUI", true )
    {
      public void
      run()
      {
        try{
View Full Code Here

     
      boolean  got_new_or_changed_result  = false;
     
      SubscriptionResultImpl[] existing_results = manager.loadResults( subs );
         
      ByteArrayHashMap  result_key_map   = new ByteArrayHashMap();
      ByteArrayHashMap  result_key2_map = new ByteArrayHashMap();
     
      List  new_results = new ArrayList();

      for (int i=0;i<existing_results.length;i++){
       
        SubscriptionResultImpl r = existing_results[i];
       
        result_key_map.put( r.getKey1(), r );
       
        byte[]  key2 = r.getKey2();
       
        if ( key2 != null ){
         
          result_key2_map.put( key2, r );
        }
       
        new_results.add( r );
       
        if ( !r.isDeleted()){
         
          if ( r.getRead()){
           
            new_read++;
           
          }else{
           
            new_unread++;
          }
        }
      }
           
      for (int i=0;i<latest_results.length;i++){

        SubscriptionResultImpl r = latest_results[i];
       
          // we first of all insist on names uniqueness
       
        SubscriptionResultImpl existing = (SubscriptionResultImpl)result_key_map.get( r.getKey1());
       
        if ( existing == null ){
         
            // only if non-unique name do we fall back and use UID to remove duplicate
            // entries where the name has changed
         
          byte[]  key2 = r.getKey2();
         
          if ( key2 != null ){
           
            existing = (SubscriptionResultImpl)result_key2_map.get( key2 );
          }
        }
       
        if ( existing == null ){
         
          last_new_result = now;
         
          new_results.add( r );
         
          result_key_map.put( r.getKey1(), r );
         
          byte[]  key2 = r.getKey2();
         
          if ( key2 != null ){
           
            result_key2_map.put( key2, r );
          }
         
          got_new_or_changed_result = true;
       
          if ( r.getRead()){
View Full Code Here

  public void
  deleteResults(
    String[] result_ids )
  {
    ByteArrayHashMap rids = new ByteArrayHashMap();
   
    for (int i=0;i<result_ids.length;i++){
     
      rids.put( Base32.decode( result_ids[i]), "" );
    }
 
    boolean  changed = false;

    synchronized( this ){
       
      SubscriptionResultImpl[] results = manager.loadResults( subs );

      for (int i=0;i<results.length;i++){
       
        SubscriptionResultImpl result = results[i];
       
        if ( !result.isDeleted() && rids.containsKey( result.getKey1())){
         
          changed = true;
         
          result.deleteInternal();
        }
View Full Code Here

  public void
  markResults(
    String[]     result_ids,
    boolean[]    reads )
  {
    ByteArrayHashMap rid_map = new ByteArrayHashMap();
   
    for (int i=0;i<result_ids.length;i++){
     
      rid_map.put( Base32.decode( result_ids[i]), new Boolean( reads[i] ));
    }
 
    boolean  changed = false;

    List  newly_unread = new ArrayList();
   
    synchronized( this ){
           
      SubscriptionResultImpl[] results = manager.loadResults( subs );

      for (int i=0;i<results.length;i++){
       
        SubscriptionResultImpl result = results[i];
       
        if ( result.isDeleted()){
         
          continue;
        }
       
        Boolean  b_read = (Boolean)rid_map.get( result.getKey1());
       
        if ( b_read != null ){
         
          boolean  read = b_read.booleanValue();
         
View Full Code Here

          break;
        }
       
        payload_buffer.flip();
       
        messages.add( new GenericMessage( msg_type, msg_desc, new DirectByteBuffer( payload_buffer ), false ));
       
        buffers[1= null;
      }
     
      total_read += bytes_read;
View Full Code Here

    if( core_msg == null ) {
      return plug_msg.create( data );
    }
   
    try{
      return new MessageAdapter( core_msg.deserialize( new DirectByteBuffer( data ), (byte)1 ) );
    }
    catch( com.aelitis.azureus.core.peermanager.messaging.MessageException e ) {
      throw new MessageException( e.getMessage() );
    }
  }
View Full Code Here

    }
   
    ByteBuffer[] bbs = plug_msg.getPayload();
    DirectByteBuffer[] dbbs = new DirectByteBuffer[ bbs.length ]//TODO cache it???
    for( int i=0; i < bbs.length; i++ ) {
      dbbs[i] = new DirectByteBuffer( bbs[i] );
    }
    return dbbs;
  }
View Full Code Here

            public void run() {
              StringWriter sw = new StringWriter();
             
              PrintWriter  pw = new PrintWriter( sw );
                 
              IndentWriter iw = new IndentWriter( pw );
             
              NetworkAdmin admin = NetworkAdmin.getSingleton();
             
              admin.generateDiagnostics( iw );
             
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.util.ByteArrayHashMap

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.