Examples of PooledByteBufferImpl


Examples of org.gudy.azureus2.pluginsimpl.local.utils.PooledByteBufferImpl

  {
    boolean  handled = false;
   
    for (int i=0;i<listeners.size();i++){
     
      PooledByteBuffer  buffer = new PooledByteBufferImpl(message.getPayload());
     
      try{
        ((GenericMessageConnectionListener)listeners.get(i)).receive( this, buffer );
       
        handled = true;
       
      }catch( Throwable f ){
       
        buffer.returnToPool();
       
        if ( !( f instanceof MessageException )){
       
          Debug.printStackTrace(f);
        }
View Full Code Here

Examples of org.gudy.azureus2.pluginsimpl.local.utils.PooledByteBufferImpl

    if ( !connected ){
     
      throw( new MessageException( "not connected" ));
    }
   
    PooledByteBufferImpl  impl = (PooledByteBufferImpl)data;
   
    try{
      connection.getOutgoingMessageQueue().addMessage(
          new GenericMessage( msg_id, msg_desc, impl.getBuffer(), false ), false );
     
    }catch( Throwable e ){
     
      throw( new MessageException( "send failed", e ));
    }
View Full Code Here

Examples of org.gudy.azureus2.pluginsimpl.local.utils.PooledByteBufferImpl

           
              // pick up any remaining data for delivery
           
            if ( in_buffer.hasRemaining()){
             
              message = new PooledByteBufferImpl( new DirectByteBuffer( in_buffer.slice()));
             
              forward  = true;
            }
          }
        }
      }
       
      if ( out_buffer != null ){
       
        out_buffer.flip();
       
        connection.send( new PooledByteBufferImpl( new DirectByteBuffer( out_buffer )));
      }
     
      if ( crypto_completed ){
       
        cryptoComplete();
View Full Code Here

Examples of org.gudy.azureus2.pluginsimpl.local.utils.PooledByteBufferImpl

     
      try{
        byte[]  plain  =  message.toByteArray();
        byte[]  enc    = outgoing_cipher.doFinal( plain );
     
        PooledByteBuffer  temp = new PooledByteBufferImpl( enc );
       
        try{
          connection.send( temp );
         
            // successfull send -> release caller's buffer
         
          message.returnToPool();
         
        }catch( Throwable e ){
         
            // failed semantics are to not release the caller's buffer
         
          temp.returnToPool();
         
          throw( e );
        }
       
      }catch( Throwable e ){
View Full Code Here

Examples of org.gudy.azureus2.pluginsimpl.local.utils.PooledByteBufferImpl

     
        try{
          byte[]  enc   = message.toByteArray();
          byte[]  plain   = incoming_cipher.doFinal( enc );
 
          PooledByteBuffer  temp = new PooledByteBufferImpl( plain );
 
          message.returnToPool();
         
          buffer_handled  = true;
         
          message  = temp;
         
        }catch( Throwable e ){
         
          throw( new MessageException( "Failed to decrypt data", e ));
        }
       
      }else if ( block_crypto != SESecurityManager.BLOCK_ENCRYPTION_NONE ){
       
        throw( new MessageException( "Crypto isn't setup" ));
      }
     
      List listeners_ref = listeners.getList();
     
      MessageException  last_error = null;
     
      for (int i=0;i<listeners_ref.size();i++){
       
        PooledByteBuffer  message_to_deliver;
       
        if ( i == 0 ){
         
          message_to_deliver  = message;
         
        }else{
       
            // unlikely we'll ever have > 1 receiver....
         
          message_to_deliver = new PooledByteBufferImpl( message.toByteArray());
        }
       
        try{
          ((GenericMessageConnectionListener)listeners_ref.get(i)).receive( this, message_to_deliver );
         
View Full Code Here

Examples of org.gudy.azureus2.pluginsimpl.local.utils.PooledByteBufferImpl

              len = max_read_chunk;
            }
           
            DirectByteBuffer buffer = core_file.read( pos, (int)len );
 
            inform( new event( new PooledByteBufferImpl( buffer ), pos, (int)len ));
           
            pos += len;
           
            rem -= len;
           
View Full Code Here

Examples of org.gudy.azureus2.pluginsimpl.local.utils.PooledByteBufferImpl

        public void
        readCompleted(
          org.gudy.azureus2.core3.disk.DiskManagerReadRequest   _request,
          DirectByteBuffer                     _data )
        {
          listener.complete( request, new PooledByteBufferImpl( _data ));
        }

        public void
        readFailed(
          org.gudy.azureus2.core3.disk.DiskManagerReadRequest   _request,
View Full Code Here

Examples of org.gudy.azureus2.pluginsimpl.local.utils.PooledByteBufferImpl

           
            int  chunk = (int)Math.min( rem, max_read_chunk );
           
            int  len = raf.read( buffer, 0, chunk );
                       
            sendEvent( new event( new PooledByteBufferImpl( buffer, 0, len ), pos, len ));
           
            rem -= len;
            pos  += len;
          }
        }catch( Throwable e ){
View Full Code Here

Examples of org.gudy.azureus2.pluginsimpl.local.utils.PooledByteBufferImpl

             
              sendEvent( new event( pos ));
             
            }else{
                             
              sendEvent( new event( new PooledByteBufferImpl( buffer, 0, len ), pos, len ));
             
              rem -= len;
              pos  += len;
            }
          }
View Full Code Here

Examples of org.gudy.azureus2.pluginsimpl.local.utils.PooledByteBufferImpl

               
                sendEvent( new event( pos ));
               
              }else{
                               
                sendEvent( new event( new PooledByteBufferImpl( buffer, 0, len ), pos, len ));
               
                rem -= len;
                pos  += len;
              }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.