From f673ea18495c467b4e2e196cf4b504d9b9b57893 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Fri, 5 Feb 2016 08:38:55 -0500 Subject: [PATCH] Session API and documentation --- .../com/frostwire/jlibtorrent/Session.java | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/frostwire/jlibtorrent/Session.java b/src/main/java/com/frostwire/jlibtorrent/Session.java index cb9feed85..b1ad9be85 100644 --- a/src/main/java/com/frostwire/jlibtorrent/Session.java +++ b/src/main/java/com/frostwire/jlibtorrent/Session.java @@ -390,19 +390,29 @@ public boolean isListening() { } /** - * Loads and saves all session settings, including dht_settings, - * encryption settings and proxy settings. ``save_state`` writes all keys - * to the ``entry`` that's passed in, which needs to either not be - * initialized, or initialized as a dictionary. + * Loads and saves all session settings, including dht settings, + * encryption settings and proxy settings. {@link #saveState()} + * internally writes all keys to an {@link entry} that's passed in, + * which needs to either not be initialized, or initialized as a dictionary. *

- * ``load_state`` expects a lazy_entry which can be built from a bencoded - * buffer with lazy_bdecode(). - *

- * The ``flags`` arguments passed in to ``save_state`` can be used to + * The {@code flags} arguments passed in to this method can be used to * filter which parts of the session state to save. By default, all state - * is saved (except for the individual torrents). see save_state_flags_t + * is saved (except for the individual torrents). + * See {@link com.frostwire.jlibtorrent.swig.session_handle.save_state_flags_t} + * + * @return + */ + public byte[] saveState(long flags) { + entry e = new entry(); + s.save_state(e); + return Vectors.byte_vector2bytes(e.bencode()); + } + + /** + * Same as calling {@link #saveState(long)} with all save state flags. * * @return + * @see #saveState(long) */ public byte[] saveState() { entry e = new entry();