请问高手,java如何下载铃声到手机,有没有例子代码,谢谢啦

解决方案 »

  1.   

    J2me MIDP 2.0+MIDlet.platformRequest("http://网址/铃声.wav");
      

  2.   

    谢谢,是这样的,我想把手机铃声文件写到手机终端,即用户通过网站下载铃声,经过测试有的可以,有的不可以,诺基亚的显示了下载进度条,但是完了却找不到铃声,实际没有下载成功。
    主要代码如下,请高手看看有没有问题,或者有更好的办法,谢谢。
    response.setContentType("audio/mp3; charset=ISO-8859-1");
                response.setHeader("Content-disposition","attachment;filename=test.mp3");            in = new FileInputStream("d:\\a.mp3");
                istr = new BufferedInputStream(in);
                servletos = response.getOutputStream();
                ostr = new BufferedOutputStream(servletos);
                byte[] bytes = new byte[4096];
                int i = 0;
                while ( ( i = istr.read( bytes , 0 , 4095 ) ) != -1 )
                {
                    ostr.write( bytes , 0 , i );
                }
                ostr.flush();
                response.flushBuffer();
      

  3.   

    这个需要使用WAP技术,基于OTA方式下载文件
    道理很简单,就是使用JSP生成WML,手机通过WAP方式下载铃声。
    具体的方案需要结合移动和联通的OTA规范才行。
      

  4.   

    是使用wap下载铃声,有没有例子可参考阿,谢谢
      

  5.   

    要直接给出http地址吗?还是一个数据流发送出去??
      

  6.   

    你是网站端还是手机端???代码要用try catch finally刮起来,这是文件的,按着改改        if (actiontmp != null && !actiontmp.equals("") && actiontmp.equals("down")) {
                String tmppathdo = request.getParameter("pathdo");
                String tmpfilename = request.getParameter("filename");
                tmpfilename = new String(tmpfilename.getBytes("GBK"), "8859_1");            response.setContentType("APPLICATION/OCTET-STREAM;charset=8859_1");
                response.setHeader("Content-Disposition", "attachment; filename=\"" + tmpfilename + "\"");
                // 打开指定文件的流信息
                java.io.FileInputStream fileInputStream = new java.io.FileInputStream(tmppathdo);
                // 写出流信息
                int tmpi;
                while ((tmpi = fileInputStream.read()) != -1) {
                    out.write(tmpi);
                }
                fileInputStream.close();
                out.close();            return;
            }