Package net.i2p.router.peermanager
Class ProfilePersistenceHelper
java.lang.Object
net.i2p.router.peermanager.ProfilePersistenceHelper
class ProfilePersistenceHelper extends Object
Write profiles to disk at shutdown,
read at startup.
The files are gzip compressed, we previously stored them
with a ".dat" extension instead of ".txt.gz", so it wasn't apparent.
Now migrated to a ".txt.gz" extension.
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_PEER_PROFILE_DIR
static String
PROP_PEER_PROFILE_DIR
-
Constructor Summary
Constructors Constructor Description ProfilePersistenceHelper(RouterContext ctx)
-
Method Summary
Modifier and Type Method Description void
deleteOldProfiles(long age)
Delete profile files with timestamps older than 'age' ago(package private) static long
getLong(Properties props, String key)
PeerProfile
readProfile(File file)
Set<PeerProfile>
readProfiles()
void
setUs(Hash routerIdentHash)
void
writeProfile(PeerProfile profile)
write out the data from the profile to the filevoid
writeProfile(PeerProfile profile, OutputStream out)
write out the data from the profile to the stream includes commentsvoid
writeProfile(PeerProfile profile, OutputStream out, boolean addComments)
write out the data from the profile to the stream
-
Field Details
-
PROP_PEER_PROFILE_DIR
- See Also:
- Constant Field Values
-
DEFAULT_PEER_PROFILE_DIR
- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
setUs
-
writeProfile
write out the data from the profile to the file -
writeProfile
write out the data from the profile to the stream includes comments- Throws:
IOException
-
writeProfile
public void writeProfile(PeerProfile profile, OutputStream out, boolean addComments) throws IOExceptionwrite out the data from the profile to the stream- Parameters:
addComments
- add comment lines to the output- Throws:
IOException
- Since:
- 0.9.41
-
readProfiles
-
deleteOldProfiles
public void deleteOldProfiles(long age)Delete profile files with timestamps older than 'age' ago- Since:
- 0.9.28
-
readProfile
-
getLong
-