Set the Serializable objects to implement the Serializable interface

This commit is contained in:
Joshua Kissoon 2014-05-12 13:12:24 +05:30
parent 0ee1001049
commit 66321280e6
4 changed files with 28 additions and 5 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
/dist/
/dist/
/build/

View File

@ -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)
@ -22,7 +22,12 @@ public class StorageEntry
this.content = new String(content.toBytes());
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();
}
}

View File

@ -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;

View File

@ -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;