Reference Codewars Problem: https://www.codewars.com/kata/52dc4688eca89d0f820004c6/java
Context: The java version of this kata sometimes passes an OutputStream and sometimes doesn't pass one to your solution, which results in needing two methods, public String execute(String code, InputStream input) and public String execute(String code, InputStream input, OutputStream output)
Question: How do you add the data (characters or int) to the output stream that is passed to you? I pass all of the tests except the output stream ones and since the Kata specified that OutputStream is OPTIONAL I am getting very frustrated. Thanks in advance.
Code so far:
public static String execute(String code, InputStream input, OutputStream output) {
String s = execute(code, input);
DataOutputStream data = new DataOutputStream(output);
try {
data.writeChars(s);
} catch (IOException ex) {
}
return s;
}
public static String execute(String code, InputStream input) {
//just pretend this code correctly interprets whitespace and returns the correct thing
}