📄 sendsmartoperatorlogo.java
字号:
package sms;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import com.objectxp.msg.GsmSmsService;
import com.objectxp.msg.MessageException;
import com.objectxp.msg.SmsService;
import com.objectxp.msg.smart.OperatorLogo;
/**
* This example demonstrates how to send a Operator Logo using jSMS.
*/
public class SendSmartOperatorLogo
{
public static void main(String args[]) throws IOException, MessageException
{
if(args.length != 4 ) {
System.err.println("Usage: SendOperatorLogo <config-file> <recipient> <country-code> <operator-code>");
System.exit(1);
}
// Create and initialize the SmsService (Replace GsmSmsService with
// the SmsService Implementation of your choice).
SmsService service = new GsmSmsService();
service.init(new File(args[0]));
URL url = SendSmartOperatorLogo.class.getResource("/media/operator.gif");
Image img = Toolkit.getDefaultToolkit().getImage(url);
// create picture message
OperatorLogo logo = new OperatorLogo();
logo.setRecipient(args[1]);
// For a list of country- and operator codes have a look at
// http://www.gsmworld.com/roaming/gsminfo/index.shtml
logo.setOperatorLogo(img,args[2],args[3]);
// connect, send the logo and disconnect
try {
service.connect();
service.sendMessage(logo);
service.disconnect();
} finally {
service.destroy();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -