net.tomp2p.storage
Class Data

java.lang.Object
  extended by net.tomp2p.storage.Data
All Implemented Interfaces:
Serializable

public class Data
extends Object
implements Serializable

This class holds the data for the transport. The data is already serialized and a hash may be created. It is reasonable to create the hash on the remote peer, but not on the local peer. The remote peer uses the hash to tell the other peers, which version is stored and its used quite often.

Author:
draft
See Also:
Serialized Form

Constructor Summary
Data(byte[] data)
           
Data(byte[] data, int offset, int length, Number160 peerId)
           
Data(byte[] data, Number160 peerId)
           
Data(ByteBuffer[] buffer, int length, Number160 peerId)
           
Data(Object object)
           
Data(Object object, Number160 peerId)
           
 
Method Summary
 long getCreated()
           
 byte[] getData()
           
 long getExpirationMillis()
           
 Number160 getHash()
           
 int getLength()
           
 Object getObject()
           
 int getOffset()
           
 Number160 getPeerId()
           
 PublicKey getPublicKey()
           
 int getTTLSeconds()
           
 boolean isDirectReplication()
           
 boolean isFileReference()
           
 boolean isProtectedEntry()
           
 Data setDirectReplication()
           
 Data setDirectReplication(boolean directReplication)
           
 Data setFileReference()
           
 Data setFileReference(boolean fileReference)
           
 Data setProtectedEntry()
           
 Data setProtectedEntry(boolean protectedEntry)
           
 Data setPublicKey(PublicKey publicKey)
           
 Data setTTLSeconds(int ttlSeconds)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Data

public Data(Object object)
     throws IOException
Throws:
IOException

Data

public Data(Object object,
            Number160 peerId)
     throws IOException
Throws:
IOException

Data

public Data(byte[] data)

Data

public Data(byte[] data,
            Number160 peerId)

Data

public Data(ByteBuffer[] buffer,
            int length,
            Number160 peerId)

Data

public Data(byte[] data,
            int offset,
            int length,
            Number160 peerId)
Method Detail

getData

public byte[] getData()

getObject

public Object getObject()
                 throws ClassNotFoundException,
                        IOException
Throws:
ClassNotFoundException
IOException

getCreated

public long getCreated()

getHash

public Number160 getHash()

getOffset

public int getOffset()

getLength

public int getLength()

getExpirationMillis

public long getExpirationMillis()

getPeerId

public Number160 getPeerId()

getTTLSeconds

public int getTTLSeconds()

setTTLSeconds

public Data setTTLSeconds(int ttlSeconds)

getPublicKey

public PublicKey getPublicKey()

setPublicKey

public Data setPublicKey(PublicKey publicKey)

isFileReference

public boolean isFileReference()

setFileReference

public Data setFileReference()

setFileReference

public Data setFileReference(boolean fileReference)

isProtectedEntry

public boolean isProtectedEntry()

setProtectedEntry

public Data setProtectedEntry()

setProtectedEntry

public Data setProtectedEntry(boolean protectedEntry)

isDirectReplication

public boolean isDirectReplication()

setDirectReplication

public Data setDirectReplication()

setDirectReplication

public Data setDirectReplication(boolean directReplication)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.