public void fromJSON(final InputStream stream) throws ColorScaleException { try { BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); StringBuilder builder = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { builder.append(line); } fromJSON(builder.toString()); } catch (IOException e) { e.printStackTrace(); throw new ColorScaleException(e); } }
public static ColorScale loadFromJSON(String json) throws ColorScaleException { ColorScale cs = new ColorScale(); cs.fromJSON(json); return cs; }
public static ColorScale loadFromJSON(InputStream stream) throws ColorScaleException { ColorScale cs = new ColorScale(); cs.fromJSON(stream); return cs; }