Package org.bitcoinj.core
Class ListMessage
- java.lang.Object
-
- org.bitcoinj.core.BaseMessage
-
- org.bitcoinj.core.ListMessage
-
- All Implemented Interfaces:
Message
- Direct Known Subclasses:
GetDataMessage
,InventoryMessage
public abstract class ListMessage extends BaseMessage
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 int
MAX_INVENTORY_ITEMS
-
Constructor Summary
Constructors Modifier Constructor Description ListMessage()
protected
ListMessage(java.util.List<InventoryItem> items)
-
Method Summary
All Methods Static 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 static java.util.List<InventoryItem>
readItems(java.nio.ByteBuffer payload)
void
removeItem(int index)
java.lang.String
toString()
-
Methods inherited from class org.bitcoinj.core.BaseMessage
messageSize, serialize
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.bitcoinj.core.Message
bitcoinSerialize, getMessageSize, unsafeBitcoinSerialize
-
-
-
-
Field Detail
-
items
protected java.util.List<InventoryItem> items
-
MAX_INVENTORY_ITEMS
public static final int MAX_INVENTORY_ITEMS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ListMessage
public ListMessage()
-
ListMessage
protected ListMessage(java.util.List<InventoryItem> items)
-
-
Method Detail
-
readItems
protected static java.util.List<InventoryItem> readItems(java.nio.ByteBuffer payload) throws java.nio.BufferUnderflowException, ProtocolException
- Throws:
java.nio.BufferUnderflowException
ProtocolException
-
getItems
public java.util.List<InventoryItem> getItems()
-
addItem
public void addItem(InventoryItem item)
-
removeItem
public void removeItem(int index)
-
bitcoinSerializeToStream
public void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOException
Description copied from class:BaseMessage
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Specified by:
bitcoinSerializeToStream
in classBaseMessage
- 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
-
-