1 /*
2  * Created on Apr 30, 2004
3  * Created by Alon Rohter
4  * Copyright (C) Azureus Software, Inc, All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  *
18  */
19 
20 package com.aelitis.azureus.core.peermanager.messaging.bittorrent;
21 
22 
23 import org.gudy.azureus2.core3.util.*;
24 
25 import com.aelitis.azureus.core.peermanager.messaging.Message;
26 import com.aelitis.azureus.core.peermanager.messaging.MessageException;
27 
28 
29 /**
30  * BitTorrent interested message.
31  */
32 public class BTInterested implements BTMessage {
33 
34   private byte version;
35 
BTInterested(byte _version)36   public BTInterested(byte _version) {
37     version = _version;
38   }
39 
getID()40   public String getID() {  return BTMessage.ID_BT_INTERESTED;  }
getIDBytes()41   public byte[] getIDBytes() {  return BTMessage.ID_BT_INTERESTED_BYTES;  }
42 
getFeatureID()43   public String getFeatureID() {  return BTMessage.BT_FEATURE_ID;  }
44 
getFeatureSubID()45   public int getFeatureSubID() {  return BTMessage.SUBID_BT_INTERESTED;  }
46 
getType()47   public int getType() {  return Message.TYPE_PROTOCOL_PAYLOAD;  }
48 
getVersion()49   public byte getVersion() { return version; };
50 
getDescription()51   public String getDescription() {  return BTMessage.ID_BT_INTERESTED;  }
52 
getData()53   public DirectByteBuffer[] getData() {  return new DirectByteBuffer[] {};  }
54 
deserialize( DirectByteBuffer data, byte version )55   public Message deserialize( DirectByteBuffer data, byte version ) throws MessageException {
56     if( data != null && data.hasRemaining( DirectByteBuffer.SS_MSG ) ) {
57       throw new MessageException( "[" +getID() +"] decode error: payload not empty" );
58     }
59 
60     if( data != null )  data.returnToPool();
61 
62     return new BTInterested(version);
63   }
64 
destroy()65   public void destroy() {  /*nothing*/  }
66 }
67