本文整理匯總了Java中codeu.chat.client.commandline.Chat類的典型用法代碼示例。如果您正苦於以下問題:Java Chat類的具體用法?Java Chat怎麽用?Java Chat使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Chat類屬於codeu.chat.client.commandline包,在下文中一共展示了Chat類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import codeu.chat.client.commandline.Chat; //導入依賴的package包/類
public static void main(String [] args) {
try {
Logger.enableFileOutput("chat_client_log.log");
} catch (IOException ex) {
LOG.error(ex, "Failed to set logger to write to file");
}
LOG.info("============================= START OF LOG =============================");
LOG.info("Starting chat client...");
final RemoteAddress address = RemoteAddress.parse(args[0]);
final ConnectionSource source = new ClientConnectionSource(address.host, address.port);
final Controller controller = new Controller(source);
final View view = new View(source);
LOG.info("Creating client...");
final Chat chat = new Chat(controller, view);
LOG.info("Created client");
final Scanner input = new Scanner(System.in);
while (chat.handleCommand(input)) {
// everything is done in "run"
}
input.close();
LOG.info("chat client has exited.");
}