Interface IMessage
-
- All Known Implementing Classes:
org.johnnei.javatorrent.internal.bittorrent.protocol.messages.AbstractBlockMessage,MessageBitfield,MessageBlock,MessageCancel,MessageChoke,MessageHave,MessageInterested,MessageKeepAlive,MessageRequest,MessageUnchoke,MessageUninterested
public interface IMessage
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetId()The id of this messageintgetLength()The length of the message (only needed on writing)
The length should include the byte for the message idvoidprocess(Peer peer)Process the messagevoidread(InStream inStream)Read a message from the inputStreamvoidwrite(OutStream outStream)Writes the message to the output stream
-
-
-
Method Detail
-
write
void write(OutStream outStream)
Writes the message to the output stream- Parameters:
outStream- The buffered outputstream to write the message on
-
read
void read(InStream inStream)
Read a message from the inputStream- Parameters:
inStream- The buffered inputstream to read the message from
-
process
void process(Peer peer)
Process the message- Parameters:
peer- The client which should process this message
-
getLength
int getLength()
The length of the message (only needed on writing)
The length should include the byte for the message id- Returns:
- integer
-
getId
int getId()
The id of this message- Returns:
- id
- Throws:
UnsupportedOperationException- Will be thrown when the message has no ID. For example:MessageKeepAlive.
-
-