Example #1
0
  public String getSimpleName() {
    String name;

    if (m_file != null) {
      name = m_file.getName();
    } else if (m_entry != null) {
      String entryName = m_entry.getName();

      if (m_entry.isDirectory()) {
        int len = entryName.length();
        int idx = entryName.lastIndexOf('/', len - 2);
        name = (idx == -1) ? entryName : entryName.substring(idx + 1, len - 1);
      } else {
        int idx = entryName.lastIndexOf('/');
        name = (idx == -1) ? entryName : entryName.substring(idx + 1);
      }
    } else if (m_composite != null) {
      name = m_composite.getName();
      // name = m_url.getFile();
    } else {
      name = "???";
    } // end if

    return name;
  }
Example #2
0
  public URL toURL() {
    URL url = null;

    try {
      if (m_file != null) {
        url = m_file.toURI().toURL();
      } else if (m_entry != null) {
        String zipPath = m_composite.getName();
        String entry = m_entry.getName();
        url = new URL("jar:file:" + zipPath + "!/" + entry);
      } else if (m_composite != null) {
        url = m_composite.toURL();
      }
    } catch (IOException ex) {
      // } catch (MalformedURLException ex) {
    }

    return url;
  }