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

📄 createurl.java

📁 ORACLE AQ sample 演示的如何出列
💻 JAVA
字号:
package oracle.otnsamples.AQ.Helper;

/**
 * @author  Rajat Gupta
 * @version 1.0
 *
 * Name of the Application        :  CreateURL.java
 * Development Environment        :  Oracle 9i JDeveloper
 * Creation/Modification History  :
 *
 *    Rajat Gupta       15-Jan-2001      Created
 *
 */

// Net Imports
import java.net.URL;
import java.net.MalformedURLException;

// IO Imports
import java.io.File;

/**
 * This class is used for Creating the URL to a particular file. The file name
 * and its path is passed to the method and which creates a URL to it and
 * returns it.
 */
public class CreateURL{
  /**
   * Empty Constructor
   */
  public CreateURL(){
  }

  /**
   * This method creates the URL to the specified file.
   *
   * @param p_fileName Fully qualified name and path to the file
   * @exception Exception Thrown in case the file is not found
   * @return URL Object to the file
   */
  public URL getURL(String p_fileName) throws Exception{
    URL url = null;
    try{
       url = new URL(p_fileName);
    }catch (MalformedURLException ex){
       File f = new File(p_fileName);
       try{
         String path = f.getAbsolutePath();
         String fs = System.getProperty("file.separator");
         if (fs.length() == 1){
           char sep = fs.charAt(0);
           if (sep != '/')
             path = path.replace(sep, '/');
           if (path.charAt(0) != '/')
             path = '/' + path;
         }
         path = "file://" + path;
         url = new URL(path);
       }catch (MalformedURLException e){
          e.printStackTrace();
          throw new Exception("AQ-1006");
       }
    }
   return url;
  }
}

⌨️ 快捷键说明

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