FileDocCategorySizeDatePackage
DHTUDPPacketData.javaAPI DocAzureus 3.0.3.44430Fri Feb 24 02:43:20 GMT 2006com.aelitis.azureus.core.dht.transport.udp.impl

DHTUDPPacketData

public class DHTUDPPacketData extends DHTUDPPacketRequest
author
parg

Fields Summary
protected static final byte
PT_READ_REQUEST
protected static final byte
PT_READ_REPLY
protected static final byte
PT_WRITE_REQUEST
protected static final byte
PT_WRITE_REPLY
private byte
packet_type
private byte[]
transfer_key
private byte[]
key
private byte[]
data
private int
start_position
private int
length
private int
total_length
public static int
MAX_DATA_SIZE
Constructors Summary
public DHTUDPPacketData(DHTTransportUDPImpl _transport, long _connection_id, DHTTransportUDPContactImpl _local_contact, DHTTransportUDPContactImpl _remote_contact)

	
	
	
						
									
				
				 
	
		super( _transport, DHTUDPPacketHelper.ACT_DATA, _connection_id, _local_contact, _remote_contact );
	
protected DHTUDPPacketData(com.aelitis.azureus.core.dht.transport.udp.impl.packethandler.DHTUDPPacketNetworkHandler network_handler, DataInputStream is, long con_id, int trans_id)

		super( network_handler, is,  DHTUDPPacketHelper.ACT_DATA, con_id, trans_id );
		
		packet_type		= is.readByte();
		transfer_key	= DHTUDPUtils.deserialiseByteArray( is, 64 );
		key				= DHTUDPUtils.deserialiseByteArray( is, 64 );
		start_position	= is.readInt();
		length			= is.readInt();
		total_length	= is.readInt();
		data			= DHTUDPUtils.deserialiseByteArray( is, 65535 );
		
		super.postDeserialise(is);
	
Methods Summary
public byte[]getData()

		return( data );
	
public intgetLength()

		return( length );
	
public bytegetPacketType()

		return( packet_type );
	
public byte[]getRequestKey()

		return( key );
	
public intgetStartPosition()

		return( start_position );
	
public java.lang.StringgetString()

		return( super.getString() + "tk=" + DHTLog.getString2( transfer_key ) + ",rk=" + 
				DHTLog.getString2( key ) + ",data=" + data.length +
				",st=" + start_position + ",len=" + length + ",tot=" + total_length );
	
public intgetTotalLength()

		return( total_length );
	
public byte[]getTransferKey()

		return( transfer_key );
	
public voidserialise(java.io.DataOutputStream os)

		super.serialise(os);
		
		os.writeByte( packet_type );
		DHTUDPUtils.serialiseByteArray( os, transfer_key, 64 );
		DHTUDPUtils.serialiseByteArray( os, key, 64 );
		os.writeInt( start_position );
		os.writeInt( length );
		os.writeInt( total_length );
		
		if ( data.length > 0 ){
			
			DHTUDPUtils.serialiseByteArray( os, data, start_position, length, 65535 );
			
		}else{
			
			DHTUDPUtils.serialiseByteArray( os, data,  65535 );
		}
		
		super.postSerialise( os );
	
public voidsetDetails(byte _packet_type, byte[] _transfer_key, byte[] _key, byte[] _data, int _start_pos, int _length, int _total_length)

		packet_type			= _packet_type;
		transfer_key		= _transfer_key;
		key					= _key;
		data				= _data;
		start_position		= _start_pos;
		length				= _length;
		total_length		= _total_length;