Package java.net

Examples of java.net.JarURLConnection


            int separator = jarUri.indexOf('!');
            if (separator >= 0) {
                jarUri = jarUri.substring(0, separator);
            }

            JarURLConnection jarConn = (JarURLConnection) packageFolderURL.openConnection();
            String rootEntryName = jarConn.getEntryName();
            int rootEnd = rootEntryName.length()+1;

            List<JavaFileObject> result = null;
            Enumeration<JarEntry> entryEnum = jarConn.getJarFile().entries();
            while (entryEnum.hasMoreElements()) {
                String name = entryEnum.nextElement().getName();
                if (name.startsWith(rootEntryName) && name.indexOf('/', rootEnd) == -1 && name.endsWith(".class")) {
                    URI uri = URI.create(jarUri + "!/" + name);
                    String binaryName = name.substring(0, name.length()-6).replace('/', '.');
View Full Code Here


                // check files in jar file, entries will list all directories
                // and files in jar

                URLConnection openConnection = location.openConnection();
                if (openConnection instanceof JarURLConnection) {
                    JarURLConnection conn = (JarURLConnection) openConnection;

                    JarFile jarFile = conn.getJarFile();

                    Manifest manifest = jarFile.getManifest();
                    if (manifest == null) {
                        // No manifest so this is not a Vaadin Add-on
                        return;
View Full Code Here

                URL url;
                try {
                    url = new URL("file:"
                            + new File(classpathEntry).getCanonicalPath());
                    url = new URL("jar:" + url.toExternalForm() + "!/");
                    JarURLConnection conn = (JarURLConnection) url
                            .openConnection();
                    debug(url.toString());

                    JarFile jarFile = conn.getJarFile();
                    Manifest manifest = jarFile.getManifest();
                    if (manifest != null) {
                        Attributes mainAttributes = manifest
                                .getMainAttributes();
                        if (mainAttributes.getValue("Vaadin-Widgetsets") != null) {
View Full Code Here

     */
    private static void includeJar(File file, Map<String, URL> locations) {
        try {
            URL url = new URL("file:" + file.getCanonicalPath());
            url = new URL("jar:" + url.toExternalForm() + "!/");
            JarURLConnection conn = (JarURLConnection) url.openConnection();
            JarFile jarFile = conn.getJarFile();
            if (jarFile != null) {
                // the key does not matter here as long as it is unique
                locations.put(url.toString(), url);
            }
        } catch (Exception e) {
View Full Code Here

     */
    public static Collection<String> listAllEntriesFor(URI uri) {
        final Collection<String> rval = new ArrayList<String>();

        try {
            final JarURLConnection connection = (JarURLConnection) new URI("jar:" + uri + "!/").toURL().openConnection();
            final JarFile jarFile = connection.getJarFile();

            final Enumeration<JarEntry> entries = jarFile.entries();

            while (entries.hasMoreElements()) {
                final JarEntry entry = entries.nextElement();
View Full Code Here

        // Disabled: Not really necessary, is it? And not storing/retrieving these items
        // makes the cache file smaller and saves several ms (~200) loading and storing it
        //if (this.cacheEntry.classesValid) { return this.cacheEntry.classes; }

        try {
            final JarURLConnection connection = (JarURLConnection) new URI("jar:" + uri + "!/").toURL().openConnection();
            final JarFile jarFile = connection.getJarFile();

            final Enumeration<JarEntry> entries = jarFile.entries();

            while (entries.hasMoreElements()) {
                final JarEntry entry = entries.nextElement();
View Full Code Here

        final String uri = this.entryMapping.get(file);

        if (uri == null) return null;

        try {
            final JarURLConnection connection = (JarURLConnection) new URI("jar:" + new File(uri).toURI() + "!/").toURL().openConnection();
            final JarFile jarFile = connection.getJarFile();

            final Enumeration<JarEntry> entries = jarFile.entries();

            while (entries.hasMoreElements()) {
                final JarEntry entry = entries.nextElement();
View Full Code Here

     */
    @Override
    public InputStream getInputStream(String file) {

        try {
            final JarURLConnection connection = (JarURLConnection) new URI("jar:" + this.location + "!/").toURL().openConnection();
            final JarFile jarFile = connection.getJarFile();

            final Enumeration<JarEntry> entries = jarFile.entries();

            while (entries.hasMoreElements()) {
                final JarEntry entry = entries.nextElement();
View Full Code Here

    // get class name from MANIFEST
    String className = null;
    try {
      URL u = new URL("jar:file:" + jarFileName + "!/");
      JarURLConnection uc = (JarURLConnection) u.openConnection();
      Attributes attr = uc.getMainAttributes();

      if (attr != null) {
        className = attr.getValue(Attributes.Name.MAIN_CLASS);
      }
    } catch (IOException ioe) {
View Full Code Here

    // get class name from MANIFEST
    String className = null;
    try {
      URL u = new URL("jar:file:" + jarFileName + "!/");
      JarURLConnection uc = (JarURLConnection) u.openConnection();
      Attributes attr = uc.getMainAttributes();

      if (attr != null)
        className = attr.getValue(Attributes.Name.MAIN_CLASS);
    } catch (IOException ioe) {
    }
View Full Code Here

TOP

Related Classes of java.net.JarURLConnection

Copyright © 2018 www.massapicom. 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.