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