FileDocCategorySizeDatePackage
HTTPMessageEncoder.javaAPI DocAzureus 3.0.3.42534Fri Feb 16 16:30:44 GMT 2007com.aelitis.azureus.core.networkmanager.impl.http

HTTPMessageEncoder

public class HTTPMessageEncoder extends Object implements com.aelitis.azureus.core.peermanager.messaging.MessageStreamEncoder

Fields Summary
private HTTPNetworkConnection
http_connection
Constructors Summary
Methods Summary
public com.aelitis.azureus.core.networkmanager.RawMessage[]encodeMessage(com.aelitis.azureus.core.peermanager.messaging.Message message)

		String	id = message.getID();
		
		// System.out.println( "encodeMessage: " + message.getID());
		
		RawMessage	raw_message = null;
		
		if ( id.equals( BTMessage.ID_BT_HANDSHAKE )){
		
			raw_message = http_connection.encodeHandShake( message );
			
		}else if ( id.equals( BTMessage.ID_BT_CHOKE )){
			
			raw_message = http_connection.encodeChoke();
		
		}else if ( id.equals( BTMessage.ID_BT_UNCHOKE )){
			
			raw_message = http_connection.encodeUnchoke();

		}else if ( id.equals( BTMessage.ID_BT_BITFIELD)){
			
			raw_message = http_connection.encodeBitField();

		}else if ( id.equals( BTMessage.ID_BT_PIECE )){
						
			return( http_connection.encodePiece( message ));
			
		}else if ( id.equals( HTTPMessage.MSG_ID )){

			raw_message = ((HTTPMessage)message).encode( message );
		}
			
		if ( raw_message == null ){
			
			raw_message = http_connection.getEmptyRawMessage( message );
		}
		
		return( new RawMessage[]{ raw_message });
	
public voidsetConnection(HTTPNetworkConnection _http_connection)

		http_connection	= _http_connection;