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

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

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

    java Source

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      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 {
    //查找設備注冊文件在jmf.jar同級目錄
            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(
    "沒有找到設備,開始注冊視頻采集設備",false,false);
            JMFInit jmfInit 
    = new JMFInit(args);
            
    boolean flag = jmfInit.isInitialError();
            jmfInit.dispose();
            
    if(flag != true)
                BubbleDialog.getBubble().display(
    "視頻采集設備注冊完畢",false,true);
            
    else 
                BubbleDialog.getBubble().display(
    "視頻采集設備注冊失敗,程序將退出",true,true);
            
    return !flag;
        }
        
        //寫入空的注冊文件(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) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 100部毛片免费全部播放完整| 亚洲第一成人在线| 国产亚洲精品美女| 四虎影视大全免费入口| 亚洲一区免费在线观看| 性xxxxx免费视频播放| 色噜噜亚洲男人的天堂| 成人免费视频试看120秒| 亚洲一区AV无码少妇电影| 大学生美女毛片免费视频| 亚洲国产精品无码久久九九大片 | 99精品视频在线视频免费观看| 亚洲精品~无码抽插| 日韩电影免费在线观看| 国产成人亚洲精品青草天美| 十八禁无码免费网站| 亚洲区精品久久一区二区三区| 最新猫咪www免费人成| 色婷婷精品免费视频| 在线日韩日本国产亚洲| 人妻丰满熟妇无码区免费| 亚洲一区二区三区免费观看| 日本一道一区二区免费看| 国产免费区在线观看十分钟| 无码欧精品亚洲日韩一区| 国产成在线观看免费视频| 久久无码av亚洲精品色午夜| 亚洲中久无码不卡永久在线观看| 亚洲av无码av制服另类专区| 日本xxxx色视频在线观看免费 | 在线精品亚洲一区二区| 亚洲成人一区二区| 97青青草原国产免费观看| 亚洲国产无线乱码在线观看| 亚洲色欲色欲www在线丝| 在线精品一卡乱码免费| 久青草国产免费观看| 亚洲精品mv在线观看| 免费在线精品视频| www.免费在线观看| 一级日本高清视频免费观看|