Skip to content

Instantly share code, notes, and snippets.

@udonchan
Created July 23, 2010 07:02
Show Gist options
  • Save udonchan/487113 to your computer and use it in GitHub Desktop.
Save udonchan/487113 to your computer and use it in GitHub Desktop.
public String load(String uri) throws IOException, InterruptedException {
final String LINE_SEPA = System.getProperty("line.separator");
Process p = Runtime.getRuntime().exec(
new String[] { "/path/to/ruby",
"/path/to/extract_content_uri.rb", uri });
BufferedReader br = null;
try {
StringBuffer out = new StringBuffer();
br = new BufferedReader(new InputStreamReader(p.getInputStream()));
for (String line; (line = br.readLine()) != null;)
out.append(line + LINE_SEPA);
if (p.exitValue() != 0)
return "";
return out.toString();
} finally {
if (br != null)
br.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment