Back to project page bitcoin-wallet.
The source code is released under:
Copyright (C) 2011 by Caleb Anderson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the ...
If you think the Android project bitcoin-wallet listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.dirtyfilthy.bitcoin.protocol; /*from w ww .jav a 2s . c o m*/ import java.io.IOException; import java.io.DataInputStream; public class InventoryPacket extends Packet { private InventoryVector[] inventoryVectors=new InventoryVector[0]; public InventoryPacket() { super(); command="inv"; } public InventoryPacket(long ver) { super(ver,"inv"); } public void setInventoryVectors(InventoryVector[] inventoryVectors) { this.inventoryVectors = inventoryVectors; } public InventoryVector[] getInventoryVectors() { return inventoryVectors; } public byte[] create(){ writeUnsignedVarInt(inventoryVectors.length); for(InventoryVector inv : inventoryVectors){ dataBuffer.put(inv.toByteArray()); } return toByteArray(); } public void readData(DataInputStream in) throws IOException{ int items=(int) readUnsignedVarInt(in); inventoryVectors=new InventoryVector[items]; for(int i=0;i<items;i++){ inventoryVectors[i]=new InventoryVector(in); } } }