public class Message extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Message.Content
8 x 4 bit.
|
static class |
Message.Type
1 x 4 bit.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
CONTENT_TYPE_LENGTH |
| Constructor and Description |
|---|
Message()
Creates message with a random ID.
|
public static final int CONTENT_TYPE_LENGTH
public int getMessageId()
public Message setMessageId(int messageId)
messageId - The message Idpublic int getVersion()
public Message setVersion(int version)
version - The 24bit versionpublic Message.Type getType()
public Message setType(Message.Type type)
type - Type of the messagepublic byte getCommand()
public Message setCommand(byte command)
command - Commandpublic PeerAddress getSender()
public Message setSender(PeerAddress sender)
sender - The ID of the sender.public PeerAddress getRecipient()
public Message setRecipient(PeerAddress recipient)
recipient - The ID of the recipientpublic Message.Content[] getContentTypes()
public Message setContentType(Message.Content contentType)
contentType - The content type to setpublic void restoreContentReferences()
public Message setContentType(int index, Message.Content contentType)
index - The indexcontentType - The content typepublic Message setContentTypes(Message.Content[] contentTypes)
contentTypes - The content types that were decoded.public Queue<NumberType> contentRefencencs()
public boolean hasContent()
public Message hasContent(boolean content)
content - We can set this already in the header to know if we have content or notpublic boolean isRequest()
public boolean isFireAndForget()
public boolean isOk()
public boolean isNotOk()
public boolean isError()
public static boolean isError(Message.Type type)
type - The type to checkpublic Message setOptions(int options)
options - The option from the last byte of the headerpublic int getOptions()
public Message setKeepAlive(boolean isKeepAlive)
isKeepAlive - True if the connection should remain open. We need to announce this in the header, as otherwise the
other end has an idle handler that will close the connection.public boolean isKeepAlive()
public Message setStreaming()
public Message streaming(boolean streaming)
public boolean isStreaming()
public Number160 getKey(int index)
public Message setBloomFilter(SimpleBloomFilter<Number160> bloomFilter)
public List<SimpleBloomFilter<Number160>> getBloomFilterList()
public SimpleBloomFilter<Number160> getBloomFilter(int index)
public Message setInteger(int integer)
public Integer getInteger(int index)
public Message setLong(long long0)
public Long getLong(int index)
public Message setNeighborsSet(NeighborSet neighborSet)
public List<NeighborSet> getNeighborsSetList()
public NeighborSet getNeighborsSet(int index)
public DataMap getDataMap(int index)
public Message setKeyCollection(KeyCollection key)
public List<KeyCollection> getKeyCollectionList()
public KeyCollection getKeyCollection(int index)
public KeyMap640 getKeyMap640(int index)
public Message setKeyMapByte(KeyMapByte keyMap)
public List<KeyMapByte> getKeyMapByteList()
public KeyMapByte getKeyMapByte(int index)
public PublicKey getPublicKey(int index)
public Message setPeerSocketAddresses(List<PeerSocketAddress> peerSocketAddresses)
public List<PeerSocketAddress> getPeerSocketAddresses()
public PublicKey getPublicKey()
public PrivateKey getPrivateKey()
public Buffer getBuffer(int index)
public Message setTrackerData(TrackerData trackerData)
public List<TrackerData> getTrackerDataList()
public TrackerData getTrackerData(int index)
public Message signatureForVerification(Signature signature, PublicKey receivedPublicKey)
public Signature signatureForVerification()
public Message receivedSignature(SHA1Signature signatureEncode)
public SHA1Signature receivedSignature()
public Message presetContentTypes(boolean presetContentTypes)
presetContentTypes - True if the content type is already set.public Message senderSocket(InetSocketAddress senderSocket)
senderSocket - The sender as we saw it on the interfacepublic InetSocketAddress senderSocket()
public Message recipientSocket(InetSocketAddress recipientSocket)
recipientSocket - The recipient as we saw it on the interfacepublic InetSocketAddress recipientSocket()
public Message setHintSign()
public boolean isSign()
public Message udp(boolean udp)
udp - True if connection is UDPpublic boolean isUdp()
public Message verified(boolean verified)
public boolean verified()
public Message setVerified()
public Message done(boolean done)
done - True if message decoding or encoding is donepublic Message setDone()
public boolean isDone()
Copyright © 2014. All rights reserved.