Skip to content

Instantly share code, notes, and snippets.

@SocraticPhoenix
Created October 26, 2017 21:19
Show Gist options
  • Save SocraticPhoenix/5f76a9075c2e6f036c16dc68b5dcf984 to your computer and use it in GitHub Desktop.
Save SocraticPhoenix/5f76a9075c2e6f036c16dc68b5dcf984 to your computer and use it in GitHub Desktop.
public static void main(String[] args) {
byte[] message = Tio.formatter()
.setInput("hello\n")
.setArgs("lol")
.setLang("shnap")
.setCode("println(sys.args[0]) println(sys.input())")
.format();
TioQueryResponse queryResponse = Tio.query(message);
if (queryResponse.getResponse().isPresent()) {
TioResponse response = queryResponse.getResponse().get();
System.out.println(response.get(TioResponse.Field.OUTPUT));
System.out.println();
System.out.println(response.get(TioResponse.Field.DEBUG));
} else {
System.out.println("Response code: " + queryResponse.getCode());
if (queryResponse.getError().isPresent()) {
System.out.println("Error: ");
queryResponse.getError().get().printStackTrace(System.out);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment