Package org.klomp.snark
Class Message
java.lang.Object
org.klomp.snark.Message
Used to queue outgoing connections
sendMessage() should be used to translate them to wire format.
-
Field Summary
Modifier and TypeFieldDescription(package private) static final byte
(package private) final int
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) byte[]
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) final int
(package private) final int
(package private) final int
(package private) final int
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) static final byte
(package private) final byte
(package private) static final byte
(package private) static final byte
-
Constructor Summary
ConstructorDescriptionMessage
(byte type) For types KEEP_ALIVE, CHOKE, UNCHOKE, INTERESTED, UNINTERESTED, HAVE_ALL, HAVE_NONEMessage
(byte[] data) For type BITFIELDMessage
(byte type, int piece) For types HAVE, PORT, SUGGEST, ALLOWED_FASTMessage
(byte type, int piece, int begin, int length) For types REQUEST, REJECT, CANCELMessage
(int id, byte[] data) For type EXTENSIONMessage
(int piece, int begin, int length, DataLoader loader) For type PIECE with deferred data -
Method Summary
Modifier and TypeMethodDescription(package private) void
Utility method for sending a message through a DataStream.toString()
-
Field Details
-
KEEP_ALIVE
static final byte KEEP_ALIVE- See Also:
-
CHOKE
static final byte CHOKE- See Also:
-
UNCHOKE
static final byte UNCHOKE- See Also:
-
INTERESTED
static final byte INTERESTED- See Also:
-
UNINTERESTED
static final byte UNINTERESTED- See Also:
-
HAVE
static final byte HAVE- See Also:
-
BITFIELD
static final byte BITFIELD- See Also:
-
REQUEST
static final byte REQUEST- See Also:
-
PIECE
static final byte PIECE- See Also:
-
CANCEL
static final byte CANCEL- See Also:
-
PORT
static final byte PORT- See Also:
-
SUGGEST
static final byte SUGGEST- See Also:
-
HAVE_ALL
static final byte HAVE_ALL- See Also:
-
HAVE_NONE
static final byte HAVE_NONE- See Also:
-
REJECT
static final byte REJECT- See Also:
-
ALLOWED_FAST
static final byte ALLOWED_FAST- See Also:
-
EXTENSION
static final byte EXTENSION- See Also:
-
HASH_REQUEST
static final byte HASH_REQUEST- See Also:
-
HASHES
static final byte HASHES- See Also:
-
HASH_REJECT
static final byte HASH_REJECT- See Also:
-
type
final byte type -
piece
final int piece -
begin
final int begin -
length
final int length -
data
byte[] data -
off
final int off -
len
final int len
-
-
Constructor Details
-
Message
Message(byte type) For types KEEP_ALIVE, CHOKE, UNCHOKE, INTERESTED, UNINTERESTED, HAVE_ALL, HAVE_NONE- Since:
- 0.9.32
-
Message
Message(byte type, int piece) For types HAVE, PORT, SUGGEST, ALLOWED_FAST- Since:
- 0.9.32
-
Message
Message(byte type, int piece, int begin, int length) For types REQUEST, REJECT, CANCEL- Since:
- 0.9.32
-
Message
Message(byte[] data) For type BITFIELD- Since:
- 0.9.32
-
Message
Message(int id, byte[] data) For type EXTENSION- Since:
- 0.9.32
-
Message
Message(int piece, int begin, int length, DataLoader loader) For type PIECE with deferred data- Since:
- 0.9.32
-
-
Method Details
-
sendMessage
Utility method for sending a message through a DataStream.- Throws:
IOException
-
toString
-