Java IP Address Get getIniFileInputStreamEclipse()

Here you can find the source of getIniFileInputStreamEclipse()

Description

Get the bpel4chor.ini file InputStream, the File Path is provided from eclipse bundle.

License

Apache License

Return

inputStream

Declaration

public static InputStream getIniFileInputStreamEclipse() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;

public class Main {
    /**/*ww w.java  2 s. c  o m*/
     * Get the bpel4chor.ini file InputStream, the File Path is provided from eclipse bundle.
     * <p>
     * <b>Note</b>: This method works only with eclipse runtime dependencies
     * @return inputStream
     */
    public static InputStream getIniFileInputStreamEclipse() {
        InputStream in = null;
        Bundle bundle = Platform.getBundle("org.bpel4chor.model");// bundle-ID in plug-in-descriptor
        Path path = new Path("config/bpel4chor.ini");
        URL fileURL = FileLocator.find(bundle, path, null);

        try {
            if (fileURL != null) {
                URL absoluteUrl = Platform.resolve(fileURL);
                //System.out.println("Get InputStream: "+new File(absoluteUrl.getFile()).getAbsolutePath());
                in = absoluteUrl.openStream();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return in;
    }
}

Related

  1. getHostIP()
  2. getHostIP()
  3. getHostIpAddress()
  4. getHostIPByHostName(String host)
  5. getInetIps()
  6. getInputStreamFromZipFile( String zipFilePath, String resourcePath)
  7. getInterfaceAddress(final String ifaceName, final boolean ipV4)
  8. getInterfaceIPs()
  9. getInternalIp()