Package java.net

Examples of java.net.URL.toURI()


    @Before
    public void setUp() {
        importer = new ImporterGEXF();
        try {
            URL url = getClass().getResource("/org/gephi/io/importer/plugin/file/testparser.gexf");
            File file = new File(url.toURI());
            importer.setReader(new FileReader(file));
        } catch (Exception ex) {
            Exceptions.printStackTrace(ex);
        }
    }
View Full Code Here


        else
            filename = "AnsweringMachine.pcma.wav";
        URL url = getClass().getClassLoader().getResource(filename);
        File file;
        try {
            file = new File(url.toURI());
        } catch (URISyntaxException e) {
            SipServletResponse resp = invite.createResponse(
                    SipServletResponse.SC_SERVER_INTERNAL_ERROR);
            resp.send();
            return;
View Full Code Here

        buf.append(getCodec(payloadType));
        buf.append(".wav");
        URL url = getClass().getClassLoader().getResource(buf.toString());
        File file;
        try {
            file = new File(url.toURI());
        } catch (URISyntaxException e) {
            Log.warn("cannot find file " + url);
            return null;
        }
        return file.getAbsolutePath();
View Full Code Here

  }
 
  protected Buffer load(String name) throws Exception
  {
    URL url = getClass().getClassLoader().getResource(name);
    File file = new File(url.toURI());
    FileInputStream fin = new FileInputStream(file);
    byte[] b = new byte[(int) file.length()];
    fin.read(b);
   
    return new ByteArrayBuffer(b);
View Full Code Here

  }
 
  protected static Buffer load(String name) throws Exception
  {
    URL url = JmxMessageLogger.class.getClassLoader().getResource(name);
    File file = new File(url.toURI());
    FileInputStream fin = new FileInputStream(file);
    byte[] b = new byte[(int) file.length()];
    fin.read(b);
   
    return new ByteArrayBuffer(b);
View Full Code Here

                    if (endJar >= 0)
                    {
                        String prefix = "jar:";
                        url = new URL(str.substring(prefix.length(), endJar));
                    }
                    File file = new File(url.toURI());
                    str = file.getAbsolutePath();
                    if (bOnlyPath)
                    {
                        if ((index = str.lastIndexOf(File.separatorChar)) >= 0)
                        path = str.substring(0, index);
View Full Code Here

                        if (result.toExternalForm().endsWith(".jar")
                                || result.toExternalForm().endsWith(".zip"))
                        {
                            result = new URL("jar:" + result.toExternalForm()
                                    + "!/" + clsAsResource);
                        } else if (new File(result.toURI()).isDirectory()) {// FIXED: result.getFile()-->result.toURI() by Francois Rioux
                            result = new URL(result, clsAsResource);
                        }
                    } catch (Exception e) {
                        // TODO add logging
                        e.printStackTrace();
View Full Code Here

public class MultiXMLConfigurationBuilderTest extends TestCase {

    public void testConfigurationBuilder() throws Exception {
        URL u = this.getClass().getClassLoader().getResource("synapse-config");
        String root = new File(u.toURI()).getAbsolutePath();

        System.out.println("Using SYNAPSE_CONFIG_HOME=" + root);
        try {
            SynapseConfiguration synapseConfig =
                    MultiXMLConfigurationBuilder.getConfiguration(root, new Properties());
View Full Code Here

            AddressType addressType = (AddressType)port.getExtensibilityElements().get(0);
            String address = addressType.getLocation();
            assertEquals("file:./Base.ref", address);           
           
            URL idl = getClass().getResource("/wsdl/addressfile.txt");
            String filename = new File(idl.toURI()).getAbsolutePath();
            generator.setAddressFile(filename);
            model = generator.generateCORBABinding();
            service = model.getService(name);
            port = service.getPort("BaseCORBAPort");
            addressType = (AddressType)port.getExtensibilityElements().get(0);
View Full Code Here

                    if (resource == null) {
                        //kind of chicken-egg problem here
                        I18n.init("en", "US");
                        throw new XMLSecurityConfigurationException("empty", "security-config.xml not found in classpath");
                    }
                    uri = resource.toURI();
                }
                saxParser.parse(uri.toURL().toExternalForm(), new XIncludeHandler(unmarshallerHandler));
                JAXBElement<ConfigurationType> configurationTypeJAXBElement = (JAXBElement<ConfigurationType>) unmarshallerHandler.getResult();

                ConfigurationProperties.init(configurationTypeJAXBElement.getValue().getProperties(), callingClass);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.