⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileresolverimpl.java

📁 java1.6众多例子参考
💻 JAVA
字号:
/* * @(#)FileResolverImpl.java	1.4 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package com.sun.corba.se.impl.resolver ;import org.omg.CORBA.ORBPackage.InvalidName;import com.sun.corba.se.spi.resolver.Resolver ;import java.util.Enumeration;import java.util.Properties;import java.util.Set;import java.util.HashSet;import java.io.File;import java.io.FileInputStream;import com.sun.corba.se.spi.orb.ORB ;import com.sun.corba.se.impl.orbutil.CorbaResourceUtil ;public class FileResolverImpl implements Resolver{    private ORB orb ;    private File file ;    private Properties savedProps ;    private long fileModified = 0 ;    public FileResolverImpl( ORB orb, File file )    {	this.orb = orb ;	this.file = file ;	savedProps = new Properties() ;    }    public org.omg.CORBA.Object resolve( String name )     {	check() ;	String stringifiedObject = savedProps.getProperty( name ) ;	if (stringifiedObject == null) {	    return null;	}	return orb.string_to_object( stringifiedObject ) ;    }    public java.util.Set list()     {	check() ;	Set result = new HashSet() ;	// Obtain all the keys from the property object	Enumeration theKeys = savedProps.propertyNames();	while (theKeys.hasMoreElements()) {	    result.add( theKeys.nextElement() ) ;	}	return result ;    }    /**    * Checks the lastModified() timestamp of the file and optionally    * re-reads the Properties object from the file if newer.    */    private void check()     {	if (file == null)	    return;	long lastMod = file.lastModified();	if (lastMod > fileModified) {	    try {		FileInputStream fileIS = new FileInputStream(file);		savedProps.clear();		savedProps.load(fileIS);		fileIS.close();		fileModified = lastMod;	    } catch (java.io.FileNotFoundException e) {		System.err.println( CorbaResourceUtil.getText(		    "bootstrap.filenotfound", file.getAbsolutePath()));	    } catch (java.io.IOException e) {		System.err.println( CorbaResourceUtil.getText(		    "bootstrap.exception",		    file.getAbsolutePath(), e.toString()));	    }	}    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -