Package api

Examples of api.User


    }
   
    @Override
    public void newUser(String username) throws IOException, UserAlreadyExistsException {
        if (!this.io.userFileExists(username)) {
            this.io.save(new User(username));
        } else {
            throw new UserAlreadyExistsException();
        }
    }
View Full Code Here


       
        Map<String, List<Message>> messages = new HashMap<String, List<Message>>();
        ArrayList<String> users = this.io.usersList();
        if (users != null) {
            for (String username : users) {
                User u = this.io.load(username);
                if (u.getUsername().equals(username)) {
                    if (u.getMessages() != null) {
                        for (Message m : u.getMessages()) {
                            if (messages.containsKey(m.getTopic())) {
                                messages.get(m.getTopic()).add(m);
                            } else {
                                ArrayList<Message> newTopicMessages = new ArrayList<Message>();
                                newTopicMessages.add(m);
View Full Code Here

        }
       
        public User load(String username) throws IOException, FileCorruptedException {
            ObjectInputStream in = new ObjectInputStream(new FileInputStream(this.getUserFile(username)));
           
            User user;
            try {
                user = (User) in.readObject();
            } catch (ClassNotFoundException e) {
                throw new FileCorruptedException();
            }
View Full Code Here

TOP

Related Classes of api.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.