<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    java Source

      BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
      14 Posts :: 24 Stories :: 8 Comments :: 0 Trackbacks
    /*
     * DevicesAutoRegister.java
     * Copyright (C) 2009  <JustinLei@gmail.com>
     *
     *        This program is free software; you can redistribute it and/or modify
     *        it under the terms of the GNU General Public License as published by
     *      the Free Software Foundation; either version 2 of the License, or
     *     (at your option) any later version.
     *
     *       This program is distributed in the hope that it will be useful,
     *      but WITHOUT ANY WARRANTY; without even the implied warranty of
     *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *        GNU General Public License for more details.
     *
     
    */
    package org.lambdasoft.device.jmf;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;

    import org.lambdasoft.ui.dialog.BubbleDialog;

    import com.sun.media.util.Registry;

    /**
     * 
    @author lei.tang (justinlei@gmail.com)
     * @date 
     * 
    @version
     
    */
    public class DevicesAutoRegister {
        
    private static DevicesAutoRegister autoRegister;
        
        
    private DevicesAutoRegister() {
        }
         
        
    public static final DevicesAutoRegister getRegister() {
            
    if(autoRegister == null)
                autoRegister 
    = new DevicesAutoRegister();
            
    return autoRegister;
        }
        
        
    public boolean regist(String args[]) throws IOException {
    //查找設(shè)備注冊(cè)文件在jmf.jar同級(jí)目錄
            File jarFile 
    = new File(Registry.class.getProtectionDomain().getCodeSource().getLocation().getFile());
            File confFile 
    = new File(jarFile.getParent() + File.separator + "jmf.properties");
            
    if(confFile.exists()) {
                
    return true;
            }
            writeConfigOrig(confFile);
            
    return _regist(args == null ? new String[0] : args);
        }
        
        
    private boolean _regist(String args[]){
            BubbleDialog.getBubble().display(
    "沒有找到設(shè)備,開始注冊(cè)視頻采集設(shè)備",false,false);
            JMFInit jmfInit 
    = new JMFInit(args);
            
    boolean flag = jmfInit.isInitialError();
            jmfInit.dispose();
            
    if(flag != true)
                BubbleDialog.getBubble().display(
    "視頻采集設(shè)備注冊(cè)完畢",false,true);
            
    else 
                BubbleDialog.getBubble().display(
    "視頻采集設(shè)備注冊(cè)失敗,程序?qū)⑼顺?/span>",true,true);
            
    return !flag;
        }
        
        //寫入空的注冊(cè)文件(JMF Configure Serializable Object)
        
    private void writeConfigOrig(File file) throws IOException{
            InputStream is 
    = DevicesAutoRegister.class.getResourceAsStream("jmf.properties.orig");
            
    byte[] buff = new byte[1024];
            FileOutputStream os 
    = new FileOutputStream(file);
            
    while(is.read(buff) != -1) {
                os.write(buff);
            }
            os.flush();
            os.close();
            is.close();
        }
    }
    posted on 2010-04-06 16:35 JustinLei 閱讀(1387) 評(píng)論(0)  編輯  收藏

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: fc2成年免费共享视频网站| 亚洲日本一线产区和二线 | 亚洲一久久久久久久久| 最近最新高清免费中文字幕| 亚洲AV天天做在线观看| 久久国产乱子伦精品免费一| 亚洲成av人片在线观看无码不卡| 美女视频黄a视频全免费网站色窝 美女被cao网站免费看在线看 | 亚洲色成人WWW永久网站| eeuss免费影院| 亚洲精品白浆高清久久久久久| 中文字幕无码一区二区免费| 亚洲AV无码专区亚洲AV伊甸园| 无码国产精品一区二区免费模式| 亚洲人成影院在线| 免费在线观看理论片| 国产成人亚洲午夜电影| 免费一级大黄特色大片| 羞羞视频免费网站在线看| 亚洲AV无码专区在线播放中文 | 国内精自视频品线六区免费| 亚洲最大天堂无码精品区| 免费国产综合视频在线看| 好男人资源在线WWW免费| 亚洲AV日韩精品久久久久久| 日韩免费一区二区三区在线| 亚洲第一综合天堂另类专| 国产偷国产偷亚洲高清日韩| 久久久国产精品福利免费| 亚洲一区中文字幕在线电影网| 国产一级理论免费版| 免费人成网站在线观看不卡 | 成年免费大片黄在线观看com| 久久精品7亚洲午夜a| 日本免费网址大全在线观看| 黄页网址在线免费观看| 久久久久久亚洲av成人无码国产| 在线精品免费视频| 一日本道a高清免费播放| 亚洲激情黄色小说| 亚洲Av无码乱码在线播放|