Code example for Scanner

Methods: nextnextIntuseDelimiter

0
    } 
 
    private ActiveConferenceMember parseConferenceMember(String line, String conferenceName) {
        ActiveConferenceMember member = new ActiveConferenceMember();
 
        Scanner scan = new Scanner(line);
        scan.useDelimiter(";");
 
        member.setId(scan.nextInt());
 
        String sipAddress = scan.next().split("/")[2];
 
        member.setUuid(scan.next());
 
        String callerIdName = scan.next();
        if (callerIdName.equals(conferenceName)) {
            callerIdName = "";
        } 
         
        scan.next(); // skip caller ID number
 
        String permissions = scan.next();
        member.setCanHear(permissions.contains("hear"));
        member.setCanSpeak(permissions.contains("speak"));
 
        member.setName(callerIdName + " (" + sipAddress + ")");
 
        member.setVolumeIn(scan.nextInt());
        member.setVolumeOut(scan.nextInt());
        member.setEnergyLevel(scan.nextInt());
        return member;
    } 
}