static class SnippetDB { static List fields; static List> rows; *() {} *(S snippetIDOfGzippedMysqlDump) { importMySQLDump(gunzipToText(snippetIDOfGzippedMysqlDump)); } void importMySQLDump(String dump) { System.out.println("Importing " + dump.length() + " chars."); Class importer = hotwire("#1000660"); set(importer, "in", dump); callMain(importer); Map tables = (Map) get(importer, "tables"); Map tableFields = (Map) get(importer, "tableFields"); fields = tableFields.get("snippets_public"); rows = tables.get("snippets_public"); } S getField(List row, S field) { int i = fields.indexOf(field); return i < 0 ? null : row.get(i); } List> rowsOrderedBy(S field) { final int i = fields.indexOf(field); List> list = new ArrayList>(rows); sort(list, new Comparator>() { public int compare(List rowA, List rowB) { S a = rowA.get(i), b = rowB.get(i); return a.compareTo(b); } }); return list; } public void finalize() { System.err.println("Note: SnippetDB released from memory."); } }