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
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
/dist/
|
||||
/build/
|
@ -9,7 +9,7 @@ package kademlia.dht;
|
||||
public class StorageEntry
|
||||
{
|
||||
|
||||
private final String content;
|
||||
private String content;
|
||||
private final StorageEntryMetadata metadata;
|
||||
|
||||
public StorageEntry(KadContent content)
|
||||
@ -23,6 +23,11 @@ public class StorageEntry
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
public void setContent(String data)
|
||||
{
|
||||
this.content = data;
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
{
|
||||
return this.content;
|
||||
@ -32,4 +37,19 @@ public class StorageEntry
|
||||
{
|
||||
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.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.Random;
|
||||
import kademlia.message.Streamable;
|
||||
|
||||
public class KademliaId implements Streamable
|
||||
public class KademliaId implements Streamable, Serializable
|
||||
{
|
||||
|
||||
public final transient static int ID_LENGTH = 160;
|
||||
|
@ -3,6 +3,7 @@ package kademlia.node;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import kademlia.message.Streamable;
|
||||
@ -14,7 +15,7 @@ import kademlia.message.Streamable;
|
||||
* @since 20140202
|
||||
* @version 0.1
|
||||
*/
|
||||
public class Node implements Streamable
|
||||
public class Node implements Streamable, Serializable
|
||||
{
|
||||
|
||||
private KademliaId nodeId;
|
||||
|
Loading…
Reference in New Issue
Block a user