四:Smack文档的下载和初步了解

来源:互联网 发布:中国移动网络维护 编辑:程序博客网 时间:2024/06/16 04:27

      从本篇开始就要进入代码篇,写代码需要看一下文档,所以我们先下载一个Smack文档。

一:Smack文档的下载

1、下载最新的Smack文档

    官方下载站点:

    http://www.igniterealtime.org/downloads/index.jsp

    下载smack_4_0_1.zip。


解压后有三个文件夹:javadoc,libs,releasedocs。打开releasedocs-documentation-index.html


让我们先看一下Overview翻译一下,翻译不对的请多多指教。吐舌头

Smack Overview

Smack is a library for communicating with XMPP servers to perform real-time communications, including instant messaging and group chat.

翻译:smack是一个与XMPP服务器进行实时通信的库,包括即时消息和群组聊天。

Smack Key Advantages

翻译:smack关键优势

Extremely simple to use, yet powerful API. Sending a text message to a user can be accomplished in only a few lines of code:

翻译:使用极其简单,但API的功能很强大。发送文本消息给用户只需要几行代码就可以完成:

Connection connection = new XMPPConnection("jabber.org");connection.connect();connection.login("mtucker", "password");Chat chat = connection.getChatManager().createChat("jsmith@jivesoftware.com", new MessageListener() {    public void processMessage(Chat chat, Message message) {        System.out.println("Received message: " + message);    }});chat.sendMessage("Howdy!");

解释一下:

"jabber.org":是服务器地址,例如192.168.1.103

"mtucker""password":是登录的用户名和密码,

"jsmith@jivesoftware.com":就是所说的jid,@前面的是登录的用户名后面的是第二篇的第六条6.配置服务器域名的域

Doesn't force you to code at the packet level, as other libraries do. Smack provides intelligent higher level constructs such as the Chat and Roster classes, which let you program more efficiently.

翻译:不强迫你在包级别去编码,和其他库一样。Smack提供智能更高层次结构像聊天和组,这让你的程序更有效。

Does not require that you're familiar with the XMPP XML format, or even that you're familiar with XML.

翻译:不要求你熟悉XMPP XML格式,甚至您熟悉XML。

Provides easy machine to machine communication. Smack lets you set any number of properties on each message, including properties that are Java objects.

翻译:提供简单的机对机通信。对于每一个消息Smack让你设置任意数量的属性,包括Java对象的属性。

Open Source under the Apache License, which means you can incorporate Smack into your commercial or non-commercial applications.

翻译:开放源码在Apache许可下,这意味着您可以让Smack进入你的商业或非商业应用。

About XMPP

翻译:关于XMPP

XMPP (eXtensible Messaging and Presence Protocol) is an open protocol standardized by the IETF and supported and extended by the XMPP Standards Foundation ((http://www.xmpp.org).

翻译:XMPP(可扩展消息处理现场协议)是一个开放的协议由IETF标准化和XMPP支持和扩展的标准基金会((http://www.xmpp.org)。

How To Use This Documentation

翻译:如何去使用这个文档

This documentation assumes that you're already familiar with the main features of XMPP instant messaging. It's also highly recommended that you open the Javadoc API guide and use that as a reference while reading through this documentation. 

翻译:本文档假设你已经熟悉XMPP即时消息的主要特点。也强烈建议您打开Javadoc API向导并作为参考使用,在阅读这个文档的时候


翻译完了,其他项我就不翻译了,你们可以自己读一读,最后他建议我们去打开javadoc作参考,那我们就打开javadoc-index.html看一下,



嗯,不错,有各种包和类,你们先看看,下一篇开始写登录代码。


0 0
原创粉丝点击