Exemple #1
0
  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);
    }
  }
Exemple #2
0
 public static ColorScale loadFromJSON(String json) throws ColorScaleException {
   ColorScale cs = new ColorScale();
   cs.fromJSON(json);
   return cs;
 }
Exemple #3
0
 public static ColorScale loadFromJSON(InputStream stream) throws ColorScaleException {
   ColorScale cs = new ColorScale();
   cs.fromJSON(stream);
   return cs;
 }