net.tomp2p.storage
Class Data
java.lang.Object
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
Data
public Data(Object object)
throws IOException
- Throws:
IOException
Data
public Data(Object object,
PeerAddress originator)
throws IOException
- Throws:
IOException
Data
public Data(byte[] data)
Data
public Data(byte[] data,
PeerAddress originator)
Data
public Data(byte[] data,
int offset,
int length,
PeerAddress originator)
getData
public byte[] getData()
getObject
public Object getObject()
throws ClassNotFoundException,
IOException
- Throws:
ClassNotFoundException
IOException
getCreated
public long getCreated()
getTTLSeconds
public int getTTLSeconds()
setTTLSeconds
public void setTTLSeconds(int ttlSeconds)
getHash
public Number160 getHash()
getOffset
public int getOffset()
getLength
public int getLength()
getExpirationMillis
public long getExpirationMillis()
isProtectedEntry
public boolean isProtectedEntry()
setProtectedEntry
public void setProtectedEntry(boolean protectedEntry)
setDirectReplication
public void setDirectReplication(boolean directReplication)
isDirectReplication
public boolean isDirectReplication()
toString
public String toString()
- Overrides:
toString
in class Object
getPeerAddress
public PeerAddress getPeerAddress()
setPeerAddress
public void setPeerAddress(PeerAddress originator)
setPublicKey
public void setPublicKey(PublicKey publicKey)
getPublicKey
public PublicKey getPublicKey()
Copyright © 2012. All Rights Reserved.