private static void doCat()

in src/main/java/com/google/devtools/build/remote/client/RemoteClient.java [460:479]


  private static void doCat(CatCommand options, RemoteClient client) throws IOException {
    OutputStream output;
    if (options.file != null) {
      output = new FileOutputStream(options.file);

      if (!options.file.exists()) {
        options.file.createNewFile();
      }
    } else {
      output = System.out;
    }

    try {
      client.getCache().downloadBlob(options.digest, output);
    } catch (CacheNotFoundException e) {
      System.err.println("Error: " + e);
    } finally {
      output.close();
    }
  }