Code example for ZipEntry

Methods: getName

0
   * {@code "string:///"} because {@link JavaCompiler} does not seem to tolerate URIs that start 
   * with {@code "jar:///"}, even though that would be more appropriate. 
   */ 
  private static URI createURIFromEntry(ZipEntry entry) {
    try { 
      return new URI("string:///" + entry.getName());
    } catch (URISyntaxException e) {
      throw new RuntimeException(e);
    } 
  } 
 
  /** 
   * Returns the contents of the {@link ZipEntry} as a string. Ensures that the entry is read at 
   * most once. 
   */ 
  private synchronized String getContentsAsString() {
    if (contents != null) {
      return contents;
    }