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>itemsstatic intMAX_INVENTORY_ITEMS
-
Constructor Summary
Constructors Modifier Constructor Description ListMessage()protectedListMessage(java.util.List<InventoryItem> items)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddItem(InventoryItem item)voidbitcoinSerializeToStream(java.io.OutputStream stream)Serializes this message to the provided stream.booleanequals(java.lang.Object o)java.util.List<InventoryItem>getItems()inthashCode()protected static java.util.List<InventoryItem>readItems(java.nio.ByteBuffer payload)voidremoveItem(int index)java.lang.StringtoString()-
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.BufferUnderflowExceptionProtocolException
-
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.IOExceptionDescription copied from class:BaseMessageSerializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Specified by:
bitcoinSerializeToStreamin classBaseMessage- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-