public byte[] saveState(save_state_flags_t flags) {
        entry e = new entry();
        s.save_state(e, flags);
        return Vectors.byte_vector2bytes(e.bencode());
    }
public byte [ ] saveState ( save_state_flags_t flags ) { entry e = new entry ( ) ; s . save_state ( e , flags ) ; return Vectors . byte_vector2bytes ( e . bencode ( ) ) ; }
Loads and saves all session settings, including dht settings,
encryption settings and proxy settings. This method
internally writes all keys to an {@link entry} that is returned
as a bencoded byte array.
<p>
The {@code flags} argument 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).

@return the bencoded byte array