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; /*w ww . jav a 2 s. c o m*/ import java.io.DataInputStream; import java.io.IOException; import net.dirtyfilthy.bitcoin.core.Address; public class AddressPacket extends Packet { private Address[] addresses; public AddressPacket() { super(); command="addr"; } public AddressPacket(long version) { super(version,"addr"); } public void setAddresses(Address[] addresses) { this.addresses = addresses; } public Address[] getAddresses() { return addresses; } public boolean timestamp(){ return (version >= 31402); } public byte[] create(){ writeUnsignedVarInt(addresses.length); for(Address addr : addresses){ dataBuffer.put(addr.toByteArray(timestamp())); } return toByteArray(); } public void readData(DataInputStream in) throws IOException{ int items=(int) Packet.readUnsignedVarInt(in); this.addresses=new Address[items]; for(int i=0;i<items;i++){ this.addresses[i]=new Address(in,timestamp()); } } }