try {
io.getOpenFile().checkWritable(context.runtime);
} catch (IOException ex) {
throw runtime.newIOErrorFromException(ex);
} catch (BadDescriptorException ex) {
throw runtime.newErrnoEBADFError();
} catch (InvalidValueException e) {
throw runtime.newErrnoEINVALError();
}
return JavaUtil.convertJavaToUsableRubyObject(context.runtime, io.getOutStream());