Package org.spoutcraft.launcher.rest

Examples of org.spoutcraft.launcher.rest.Project


  private static int requestLatestLauncherBuild() throws RestfulAPIException {
    String url = RestAPI.getLauncherURL(Settings.getLauncherChannel());
    InputStream stream = null;
    try {
      stream = RestAPI.getCachingInputStream(new URL(url), true);
      Project project = mapper.readValue(stream, Project.class);
      return project.getBuild();
    } catch (IOException e) {
      throw new RestfulAPIException("Error accessing URL [" + url + "]", e);
    } finally {
      IOUtils.closeQuietly(stream);
    }
View Full Code Here


  private static String calcaulateMD5(String build) throws RestfulAPIException {
    String url = RestAPI.getSpoutcraftURL(build);
    InputStream stream = null;
    try {
      stream = RestAPI.getCachingInputStream(new URL(url), true);
      Project project = mapper.readValue(stream, Project.class);
      return project.getMd5();
    } catch (IOException e) {
      throw new RestfulAPIException("Error accessing URL [" + url + "]", e);
    } finally {
      IOUtils.closeQuietly(stream);
    }
View Full Code Here

    if (getLatestMinecraft().equals(getMinecraft())) {
      int build;
      String url = RestAPI.getSpoutcraftURL(channel);
      try {
        stream = RestAPI.getCachingInputStream(new URL(url), true);
        Project project = mapper.readValue(stream, Project.class);
        build = project.getBuild();
      } catch (IOException e) {
        throw new RestfulAPIException("Error accessing URL [" + url + "]", e);
      } finally {
        IOUtils.closeQuietly(stream);
      }
      // Check to see if stable has newer release
      if (channel == Channel.STABLE) {
        return String.valueOf(build);
      } else {
        url = RestAPI.getSpoutcraftURL(Channel.STABLE);
        try {
          stream = RestAPI.getCachingInputStream(new URL(url), true);
          Project stable = mapper.readValue(stream, Project.class);
          // Stable release is newer
          if (stable.getBuild() > build) {
            return String.valueOf(stable.getBuild());
          } else {
            return String.valueOf(build);
          }
        } catch (IOException e) {
          throw new RestfulAPIException("Error accessing URL [" + url + "]", e);
View Full Code Here

TOP

Related Classes of org.spoutcraft.launcher.rest.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.