亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? samplemmscreation.java

?? 彩信開發包
?? JAVA
字號:
/*
 * @(#)SampleMMSCreation.java	1.0
 *
 *
 * This sample was derived from the OriginatingApp.java file which came with the
 * Nokia MMS Java Library 1.1
 *
 * Instead of sending the MMS to an MMSC, however, this sample simply writes the
 * encoded MMS to a file.  That file can then be used, e.g. with various tools
 * that are provided by Nokia -- the EAIF emulator, the Series60 terminal emulator
 * that comes with the Series60 SDK for Symbian OS, the 7210 simulator, etc...
 *
 * The sample is made as simple as possible while still pointing out key points
 * which are *not* explained in the samples that accompany the library.
 * For instance, many of the headers that were set in the original sample were set
 * to default values.  Those have been left out here for simplification.
 *
 * Note - this sample was changed with only limited knowledge of Java.  Java experts
 * are welcome to give feedback, and non-Java-experts may take heart that if we can
 * do it, you can too!
 *
 * Basic gist of this sample will be:
 * 1)Set headers
 * 2)Add various content parts
 * 3)Encode the message
 * 4)Write the encoded message to a file
 *
 *
 *
 * Change History
 * ----------------------------------------------------------------------------
 * * 25-09-2002 * Version 1.0 * Document added into ForumNokia                *
 * ----------------------------------------------------------------------------
 *
 *
 *
 * Copyright (c) Nokia Corporation 2002
 *
 */

import java.io.*;
import java.util.*;
import java.net.*;
import com.nokia.mms.*;

public class SampleMMSCreation {

  public SampleMMSCreation() {
    MMMessage mms = new MMMessage();
//1)Set headers
    SetHeaders(mms);
//2)Add various content parts
    AddContents(mms);

    MMEncoder encoder=new MMEncoder();
    encoder.setMessage(mms);

    try {
//3)Encode the message
      encoder.encodeMessage();
      byte[] out = encoder.getMessage();
//4)Print the encoded message to a file
      createMmsFile(out, "Sample.mms");
    }
    catch (Exception e) {
      System.out.println(e.getMessage());
    }
  }

  private void SetHeaders(MMMessage m) {
	//Just going to set the mandatories, and the subject...
	//Type,TransID,Version are all mandatory, and must be the first headers, in this order!
	m.setMessageType(IMMConstants.MESSAGE_TYPE_M_SEND_REQ);
    m.setTransactionId("0123456789");
    m.setVersion(IMMConstants.MMS_VERSION_10);

    m.setFrom("+123/TYPE=PLMN");
    m.addToAddress("+456/TYPE=PLMN"); //at least one To/CC/BCC is mandatory

    m.setSubject("My first test message!"); //subject is optional

    //ContentType is mandatory, and must be last header!  These last 3 lines set the ContentType to
    //application/vnd.wml.multipart.related;type="application/smil";start="<0000>"
    //In case of multipart.mixed, only the first line is needed (and change the constant)

    //Any string will do for the Content-ID, but it must match that used for the presentation part,
    //and it must be Content-ID, it cannot be Content-Location.

    m.setContentType(IMMConstants.CT_APPLICATION_MULTIPART_RELATED);
    m.setMultipartRelatedType(IMMConstants.CT_APPLICATION_SMIL); //presentation part is written in SMIL
    m.setPresentationId("<0000>"); // presentation part has Content-ID=<0000>

  }

  private void AddContents(MMMessage m) {

    //This is where the majority of the work is done.  Note that here we are adding the parts of the
    //message in the order we want them to appear.  Actually the presentation part specifies that,
    //but in terminals which cannot understand the presentation part, the order may be significant,
    //so there seems to be no reason to use random order.

    //Note also, that the current version (1.1) of the library encodes the message in some sort
    //of random order, so developers must either fix that problem using the source code, or
    //be prepared for random order output.

    // Path where contents are stored assumed to be same as this class...
    String path = getPath();

    // Add SMIL content
    MMContent smil_part = new MMContent();
    byte[] b1 = readFile(path + "HelloWorld.smil");
    smil_part.setContent(b1, 0, b1.length);
    smil_part.setContentId("<0000>"); //If "<>" are used with this method, the result is Content-ID
    smil_part.setType(IMMConstants.CT_APPLICATION_SMIL);
    m.addContent(smil_part);

    // Add slide1 text
    MMContent s1_text = new MMContent();
    byte[] b2 = readFile(path + "HelloWorld.txt");
    s1_text.setContent(b2,0,b2.length);
    s1_text.setContentId("HelloWorld.txt"); //If "<>" are not used with this method, the result is Content-Location
    s1_text.setType(IMMConstants.CT_TEXT_PLAIN);
    m.addContent(s1_text);
    // Add slide1 image
    MMContent s1_image = new MMContent();
    byte[] b3 = readFile(path + "SmileyFace.gif");
    s1_image.setContent(b3,0,b3.length);
    s1_image.setContentId("SmileyFace.gif");
    s1_image.setType(IMMConstants.CT_IMAGE_GIF);
    m.addContent(s1_image);
    // Add slide1 audio
    MMContent s1_audio = new MMContent();
    byte[] b4 = readFile(path + "HelloWorld.amr");
    s1_audio.setContent(b4,0,b4.length);
    s1_audio.setContentId("HelloWorld.amr");
    s1_audio.setType("audio/amr"); //Note how to use mime-types with no pre-defined constant!
    m.addContent(s1_audio);

    // Add slide2 text
    MMContent s2_text = new MMContent();
    byte[] b5 = readFile(path + "TheEnd.txt");
    s2_text.setContent(b5,0,b5.length);
    s2_text.setContentId("<TheEnd.txt>");  //Here, again, we are using Content-ID - just for demonstration
    s2_text.setType(IMMConstants.CT_TEXT_PLAIN);
    m.addContent(s2_text);
    // Add slide2 image
    MMContent s2_image = new MMContent();
    byte[] b6 = readFile(path + "TheEnd.gif");
    s2_image.setContent(b6,0,b6.length);
    s2_image.setContentId("<TheEnd.gif>");
    s2_image.setType(IMMConstants.CT_IMAGE_GIF);
    m.addContent(s2_image);
    // Add slide2 audio
    MMContent s2_audio = new MMContent();
    byte[] b7 = readFile(path + "YallComeBackNowYaHear.amr");
    s2_audio.setContent(b7,0,b7.length);
    s2_audio.setContentId("<YCBNYH.amr>"); //Note that the filename and Content-ID don't need to be the same
    s2_audio.setType("audio/amr");
    m.addContent(s2_audio);
  }

  private byte[] readFile(String filename) {
    int fileSize=0;
    RandomAccessFile fileH=null;

    // Opens the file for reading.
    try {
      fileH = new RandomAccessFile(filename, "r");
      fileSize = (int) fileH.length();
    } catch (IOException ioErr) {
      System.err.println("Cannot find " + filename);
      System.err.println(ioErr);
      System.exit(200);
    }

    // allocates the buffer large enough to hold entire file
    byte[] buf = new byte[fileSize];

    // reads all bytes of file
    int i=0;
    try {
       while (true) {
         try {
           buf[i++] = fileH.readByte();
         } catch (EOFException e) {
          break;
         }
       }
    } catch (IOException ioErr) {
     System.out.println("ERROR in reading of file"+filename);
    }

    return buf;
  }

  private String getPath() {
    URL url = getClass().getResource(getClass().getName() + ".class");
    String classPath = url.getHost() + url.getFile();
    int pos = classPath.lastIndexOf("/");
    return classPath.substring(0, pos + 1);
  }

  public void createMmsFile(byte[] output,String filename) {
	try	{
	  String path = getPath();
	  File f = new File( path + filename);
	  FileOutputStream out = new FileOutputStream(f);

  	  out.write(output);
	  out.close();
	}
	catch (Exception e)	{
	  System.out.println(e.getMessage());
	}
  }

  public static void main (String[] args) {
    SampleMMSCreation oa = new SampleMMSCreation();
  }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩精品欧美日韩精品一综合| 日本乱人伦一区| 爽爽淫人综合网网站| 亚洲永久免费视频| 亚洲影院理伦片| 国产大陆亚洲精品国产| 国产专区欧美精品| 国产一区在线看| 粉嫩嫩av羞羞动漫久久久| 国产91精品在线观看| 99天天综合性| 欧美综合久久久| 欧美一区二区三区公司| 日韩欧美国产一区二区三区| 日韩视频一区二区三区| 久久精品男人天堂av| 成人免费在线视频观看| 亚洲线精品一区二区三区| 亚洲国产精品综合小说图片区| 日韩在线一二三区| 韩国一区二区在线观看| 成人av一区二区三区| 色999日韩国产欧美一区二区| 欧美三级中文字| 欧美成人综合网站| 自拍偷拍国产精品| 日韩av不卡在线观看| 韩国一区二区在线观看| 色一区在线观看| 日韩一区二区三区电影| 国产精品午夜在线观看| 亚洲18女电影在线观看| 国产剧情av麻豆香蕉精品| 91美女精品福利| 精品久久国产老人久久综合| 国产精品久久久久久久久搜平片| 亚洲第一主播视频| 国产高清亚洲一区| 欧美久久免费观看| 中文久久乱码一区二区| 日韩av在线发布| fc2成人免费人成在线观看播放| 欧美视频精品在线| 亚洲国产精品黑人久久久| 午夜精品在线看| 成人精品一区二区三区四区| 555夜色666亚洲国产免| 国产精品丝袜91| 美女脱光内衣内裤视频久久网站| 97精品视频在线观看自产线路二| 欧美一区二区三区在线视频| 国产欧美一区二区三区网站| 亚洲福利电影网| 色综合一个色综合亚洲| 久久青草欧美一区二区三区| 五月天欧美精品| 色婷婷亚洲综合| 国产精品理论片在线观看| 久久97超碰色| 在线播放欧美女士性生活| 亚洲欧美偷拍另类a∨色屁股| 久久99久久久久| 欧美日本在线观看| 免费av网站大全久久| 欧美午夜电影网| 玉米视频成人免费看| 9i看片成人免费高清| 久久精品夜色噜噜亚洲aⅴ| 日韩中文字幕亚洲一区二区va在线| 91一区在线观看| 中文字幕欧美激情一区| 国产精品中文字幕日韩精品| 日韩欧美激情在线| 美女在线视频一区| 欧美一区二区成人6969| 亚洲va欧美va国产va天堂影院| 日本精品视频一区二区| 亚洲蜜臀av乱码久久精品蜜桃| jlzzjlzz国产精品久久| 亚洲视频香蕉人妖| 91伊人久久大香线蕉| 亚洲欧洲日产国产综合网| 成人动漫精品一区二区| 亚洲色图一区二区三区| 91香蕉视频mp4| 亚洲激情在线播放| 欧美日韩一区二区三区不卡| 亚洲成人久久影院| 欧美一区二区视频网站| 毛片av中文字幕一区二区| 日韩精品影音先锋| 国产麻豆午夜三级精品| 久久久久久久免费视频了| 成人午夜在线视频| 亚洲另类在线一区| 91精品国产高清一区二区三区蜜臀 | 亚洲欧洲精品一区二区精品久久久| 精品无人区卡一卡二卡三乱码免费卡| 日韩免费一区二区| 成人午夜视频网站| 亚洲私人黄色宅男| 91.com在线观看| 久久99精品一区二区三区三区| 久久久亚洲高清| 91色.com| 久久99国产精品成人| 国产精品网站在线观看| 欧美在线制服丝袜| 秋霞成人午夜伦在线观看| 国产校园另类小说区| 91丨porny丨国产入口| 午夜成人在线视频| 国产无一区二区| 欧美无人高清视频在线观看| 久久精品国内一区二区三区| 日本一区二区动态图| 欧美日韩在线播放一区| 国产尤物一区二区| 亚洲国产色一区| 久久品道一品道久久精品| 在线观看日韩国产| 国产乱子伦一区二区三区国色天香| 国产精品欧美久久久久一区二区 | 日韩成人免费看| 国产精品久久久久影院亚瑟| 欧美日韩一区二区三区不卡| 国产成人在线免费| 日本亚洲视频在线| 亚洲色图色小说| 国产天堂亚洲国产碰碰| 欧美日韩国产精品自在自线| 成人免费毛片a| 美女视频一区在线观看| 亚洲一区二区欧美激情| 久久久久88色偷偷免费 | 国产成人午夜高潮毛片| 亚洲成在人线在线播放| 亚洲欧洲韩国日本视频| 日韩一区二区三区视频在线 | 91精品在线麻豆| www.欧美日韩国产在线| 另类中文字幕网| 亚洲国产乱码最新视频| 亚洲女人****多毛耸耸8| 国产欧美中文在线| 欧美成人a视频| 欧美精品第1页| 日本韩国欧美在线| 播五月开心婷婷综合| 国产一区二区三区四区五区美女| 手机精品视频在线观看| 一区二区成人在线视频| 17c精品麻豆一区二区免费| 国产亚洲人成网站| 26uuu国产一区二区三区| 在线综合视频播放| 日本韩国欧美国产| 91福利视频在线| 色综合久久久久综合99| gogo大胆日本视频一区| fc2成人免费人成在线观看播放| 国产激情偷乱视频一区二区三区| 国模冰冰炮一区二区| 国产资源在线一区| 国产成人免费视频网站| 国产精品996| 成人免费看黄yyy456| 成人激情免费网站| www.欧美日韩| 色综合天天狠狠| 欧美性色欧美a在线播放| 欧美影院一区二区三区| 欧美日韩国产高清一区| 欧美一区二区三级| 精品国产a毛片| 久久精品一区二区三区四区| 欧美国产日本视频| 亚洲精品伦理在线| 午夜精品爽啪视频| 蜜臀av亚洲一区中文字幕| 精东粉嫩av免费一区二区三区 | 午夜私人影院久久久久| 日韩av电影一区| 国产馆精品极品| 91视频xxxx| 51午夜精品国产| 久久精品一区二区| 一区二区三区av电影| 国产成人免费视频一区| 91亚洲男人天堂| 欧美日韩www| 久久嫩草精品久久久精品一| 国产精品久久久久久久久免费桃花| 一区二区三区四区在线| 免费黄网站欧美| aaa国产一区| 日韩一区二区三免费高清| 国产欧美一区二区三区鸳鸯浴 | 国产视频一区在线观看 | 欧美日韩国产高清一区二区三区|