package jalview.io;
import java.io.IOException;
+import java.io.StringReader;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
Document doc = Jsoup.parse(htmlData.toString());
Element content = doc.getElementById("seqData");
- String alignmentJsonString = content.val();
-
- JSONFile jsonFile = new JSONFile().parse(alignmentJsonString);
+ JSONFile jsonFile = new JSONFile().parse(new StringReader(content.val()));
this.seqs = jsonFile.getSeqs();
this.seqGroups = jsonFile.getSeqGroups();
this.annotations = jsonFile.getAnnotations();
package jalview.io;
-import java.awt.Color;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-
import jalview.api.AlignViewportI;
import jalview.api.ComplexAlignFile;
import jalview.api.FeatureRenderer;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
+import java.awt.Color;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+
public class JSONFile extends AlignFile implements ComplexAlignFile
{
private ColourSchemeI colourScheme;
@Override
public void parse() throws IOException
{
- StringBuilder jsonStringBuilder = new StringBuilder();
- String currentLine;
- while ((currentLine = nextLine()) != null)
- {
- jsonStringBuilder.append(currentLine);
- }
- parse(jsonStringBuilder.toString());
+ parse(getReader());
}
}
@SuppressWarnings("unchecked")
- public JSONFile parse(String jsonAlignmentString)
+ public JSONFile parse(Reader jsonAlignmentString)
{
try
{