use of com.biglybt.ui.console.multiuser.UserManager.UserManagerConfig in project BiglyBT by BiglySoftware.
the class UserManagerXMLPersist method doSave.
/**
* This code abstracted because it relies on java.beans.* which is not always available
* e.g. on Android
*/
@Override
public void doSave(OutputStream out, Map usersMap) {
UserManagerConfig config = new UserManagerConfig();
List users = new ArrayList(usersMap.values());
config.setUsers(users);
XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(out));
encoder.writeObject(config);
encoder.close();
}
use of com.biglybt.ui.console.multiuser.UserManager.UserManagerConfig in project BiglyBT by BiglySoftware.
the class UserManagerXMLPersist method doLoad.
@Override
public void doLoad(InputStream in, Map usersMap) {
XMLDecoder decoder = new XMLDecoder(in);
UserManagerConfig managerConfig = (UserManagerConfig) decoder.readObject();
for (Iterator iter = managerConfig.getUsers().iterator(); iter.hasNext(); ) {
UserProfile user = (UserProfile) iter.next();
usersMap.put(user.getUsername().toLowerCase(), user);
}
System.out.println("UserManager: registered " + usersMap.size() + " users");
decoder.close();
}
Aggregations