Package org.bitcoinj.core
Class ListMessage
- java.lang.Object
-
- org.bitcoinj.core.Message
-
- org.bitcoinj.core.ListMessage
-
- Direct Known Subclasses:
GetDataMessage
,InventoryMessage
public abstract class ListMessage extends Message
Abstract superclass of classes with list based payload, ie InventoryMessage and GetDataMessage.
Instances of this class are not safe for use by multiple threads.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<InventoryItem>
items
static long
MAX_INVENTORY_ITEMS
-
Fields inherited from class org.bitcoinj.core.Message
MAX_SIZE, params, payload, serializer
-
-
Constructor Summary
Constructors Constructor Description ListMessage(NetworkParameters params)
ListMessage(NetworkParameters params, java.nio.ByteBuffer payload)
ListMessage(NetworkParameters params, java.nio.ByteBuffer payload, MessageSerializer serializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addItem(InventoryItem item)
void
bitcoinSerializeToStream(java.io.OutputStream stream)
Serializes this message to the provided stream.boolean
equals(java.lang.Object o)
java.util.List<InventoryItem>
getItems()
int
hashCode()
protected void
parse()
void
removeItem(int index)
java.lang.String
toString()
-
Methods inherited from class org.bitcoinj.core.Message
bitcoinSerialize, getHash, getMessageSize, getParams, readByte, readByteArray, readBytes, readHash, readInt32, readInt64, readStr, readUint32, readUint64, readVarInt, skipBytes, unCache, unsafeBitcoinSerialize
-
-
-
-
Field Detail
-
items
protected java.util.List<InventoryItem> items
-
MAX_INVENTORY_ITEMS
public static final long MAX_INVENTORY_ITEMS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ListMessage
public ListMessage(NetworkParameters params, java.nio.ByteBuffer payload) throws ProtocolException
- Throws:
ProtocolException
-
ListMessage
public ListMessage(NetworkParameters params, java.nio.ByteBuffer payload, MessageSerializer serializer) throws ProtocolException
- Throws:
ProtocolException
-
ListMessage
public ListMessage(NetworkParameters params)
-
-
Method Detail
-
getItems
public java.util.List<InventoryItem> getItems()
-
addItem
public void addItem(InventoryItem item)
-
removeItem
public void removeItem(int index)
-
parse
protected void parse() throws java.nio.BufferUnderflowException, ProtocolException
- Specified by:
parse
in classMessage
- Throws:
java.nio.BufferUnderflowException
ProtocolException
-
bitcoinSerializeToStream
public void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOException
Description copied from class:Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStream
in classMessage
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-