mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-24 11:12:18 +00:00
Set the Serializable objects to implement the Serializable interface
This commit is contained in:
parent
0ee1001049
commit
66321280e6
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/dist/
|
/dist/
|
||||||
|
/build/
|
@ -9,7 +9,7 @@ package kademlia.dht;
|
|||||||
public class StorageEntry
|
public class StorageEntry
|
||||||
{
|
{
|
||||||
|
|
||||||
private final String content;
|
private String content;
|
||||||
private final StorageEntryMetadata metadata;
|
private final StorageEntryMetadata metadata;
|
||||||
|
|
||||||
public StorageEntry(KadContent content)
|
public StorageEntry(KadContent content)
|
||||||
@ -22,7 +22,12 @@ public class StorageEntry
|
|||||||
this.content = new String(content.toBytes());
|
this.content = new String(content.toBytes());
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setContent(String data)
|
||||||
|
{
|
||||||
|
this.content = data;
|
||||||
|
}
|
||||||
|
|
||||||
public String getContent()
|
public String getContent()
|
||||||
{
|
{
|
||||||
return this.content;
|
return this.content;
|
||||||
@ -32,4 +37,19 @@ public class StorageEntry
|
|||||||
{
|
{
|
||||||
return this.metadata;
|
return this.metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder("[StorageEntry: ");
|
||||||
|
|
||||||
|
sb.append("[Content: ");
|
||||||
|
sb.append(this.getContent());
|
||||||
|
sb.append("]");
|
||||||
|
|
||||||
|
sb.append(this.getContentMetadata());
|
||||||
|
|
||||||
|
sb.append("]");
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,14 @@ package kademlia.node;
|
|||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import kademlia.message.Streamable;
|
import kademlia.message.Streamable;
|
||||||
|
|
||||||
public class KademliaId implements Streamable
|
public class KademliaId implements Streamable, Serializable
|
||||||
{
|
{
|
||||||
|
|
||||||
public final transient static int ID_LENGTH = 160;
|
public final transient static int ID_LENGTH = 160;
|
||||||
|
@ -3,6 +3,7 @@ package kademlia.node;
|
|||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import kademlia.message.Streamable;
|
import kademlia.message.Streamable;
|
||||||
@ -14,7 +15,7 @@ import kademlia.message.Streamable;
|
|||||||
* @since 20140202
|
* @since 20140202
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*/
|
*/
|
||||||
public class Node implements Streamable
|
public class Node implements Streamable, Serializable
|
||||||
{
|
{
|
||||||
|
|
||||||
private KademliaId nodeId;
|
private KademliaId nodeId;
|
||||||
|
Loading…
Reference in New Issue
Block a user