现在的位置: 首页 > 综合 > 正文

获取build.prop中的指定属性

2013年04月16日 ⁄ 综合 ⁄ 共 538字 ⁄ 字号 评论关闭
  // 获取build.prop中的指定属性 
    public static String GetBuildProproperties(String PropertiesName) {     
    	try    {        
    		InputStream is = new BufferedInputStream(new FileInputStream(new File("/system/build.prop")));  
    		BufferedReader br = new BufferedReader(new InputStreamReader(is));    
    		String strTemp = "";        
    		while ((strTemp = br.readLine()) != null)      
    		{// 如果文件没有读完则继续           
    			if (strTemp.indexOf(PropertiesName) != -1)    
    				return strTemp.substring(strTemp.indexOf("=") + 1);       
    		}      
    		br.close();       
    		is.close();         
    		return null;    
    		}catch (Exception e){     
    			if (e.getMessage() != null)  
    				System.out.println( e.getMessage());      
    			else           
    				e.printStackTrace();     
    			return null;    
    			} 
    		} 

抱歉!评论已关闭.