Skip to main content
summaryrefslogtreecommitdiffstats
blob: 129c911db503bef0c159407a178c56ec02c5150d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * Copyright (c) 2009-2012 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.net4j.util.tests;

import org.eclipse.net4j.util.io.IOUtil;
import org.eclipse.net4j.util.om.OMBundle;

import java.io.InputStream;
import java.net.URL;

/**
 * @author Eike Stepper
 */
public class OMTest
{
  /**
   * Requires this class to be exported to a jar file in this project's plugins/ folder!<br>
   * Also requires an export of the net4j.util bundle in the same folder!
   */
  public static void main(String[] args) throws Exception
  {
    OMBundle bundle = org.eclipse.net4j.internal.util.bundle.OM.BUNDLE;

    URL baseUrl = bundle.getBaseURL();
    IOUtil.OUT().println(baseUrl);
    IOUtil.OUT().println();

    InputStream stream = bundle.getInputStream("/plugin.xml"); //$NON-NLS-1$

    try
    {
      IOUtil.copy(stream, IOUtil.OUT());
    }
    finally
    {
      IOUtil.close(stream);
    }
  }
}

Back to the top