- File cache = new File(dir, preselector);
- cache.mkdirs();
- File cacheHtml = new File(cache, "index.html");
- cache = new File(cache, ".cache");
+ StringBuilder gopherBuilder = new StringBuilder();
+ StringBuilder htmlBuilder = new StringBuilder();
+
+ BasicSupport.setPreselector(preselector);
+ for (Type type : Type.values()) {
+ BasicSupport support = BasicSupport.getSupport(type);
+
+ if (type == this.type || this.type == null) {
+ list(support);
+ }
+
+ gopherBuilder.append("1" + support.getDescription()).append("\t")
+ .append("1" + support.getSelector()) //
+ .append("\t").append(hostname) //
+ .append("\t").append(Integer.toString(port)) //
+ .append("\r\n");
+
+ String ref = support.getSelector();
+ while (ref.startsWith("/")) {
+ ref = ref.substring(1);
+ }
+ htmlBuilder.append("<div class='site'><a href='../" + ref + "'>"
+ + support.getDescription() + "</a></div>\n");
+ }
+
+ File gopherCache = new File(dir, preselector);
+ gopherCache.mkdirs();
+ File htmlIndex = new File(gopherCache, "index.html");
+ gopherCache = new File(gopherCache, ".cache");