public void handleCommand ( ) throws IOException { this . currentLine = this . reader . readLine ( ) ; if ( this . currentLine == null ) { LOGGER . severe ( "Current line is null!" ) ; this . exit ( ) ; return ; } final StringTokenizer st = new StringTokenizer ( this . currentLine , " " ) ; final String commandName = st . nextToken ( ) . toUpperCase ( ) ; final String arg = st . hasMoreTokens ( ) ? st . nextToken ( ) : null ; if ( commandName == null ) { LOGGER . severe ( "Command name is empty!" ) ; this . exit ( ) ; return ; } if ( commandName . equals ( "STAT" ) ) { this . stat ( ) ; } else if ( commandName . equals ( "LIST" ) ) { this . list ( ) ; } else if ( commandName . equals ( "RETR" ) ) { this . retr ( arg ) ; } else if ( commandName . equals ( "DELE" ) ) { this . dele ( ) ; } else if ( commandName . equals ( "NOOP" ) ) { this . noop ( ) ; } else if ( commandName . equals ( "RSET" ) ) { this . rset ( ) ; } else if ( commandName . equals ( "QUIT" ) ) { this . quit ( ) ; } else if ( commandName . equals ( "TOP" ) ) { this . top ( arg ) ; } else if ( commandName . equals ( "UIDL" ) ) { this . uidl ( ) ; } else if ( commandName . equals ( "USER" ) ) { this . user ( ) ; } else if ( commandName . equals ( "PASS" ) ) { this . pass ( ) ; } else if ( commandName . equals ( "CAPA" ) ) { this . println ( "-ERR CAPA not supported" ) ; } else { LOGGER . log ( Level . SEVERE , "ERROR command unknown: {0}" , commandName ) ; this . println ( "-ERR unknown command" ) ; } }
Handle command .