/* rb: writable */
  private void checkWritable() {
    checkInitialized();
    if (data.closedWrite || !data.modes.isWritable()) {
      throw getRuntime().newIOError("not opened for writing");
    }

    // Tainting here if we ever want it. (secure 4)
  }
  @JRubyMethod
  @Override
  public IRubyObject close() {
    checkInitialized();
    checkOpen();

    data.closedRead = true;
    data.closedWrite = true;

    return getRuntime().getNil();
  }
 @JRubyMethod(name = "closed_write?")
 @Override
 public IRubyObject closed_write_p() {
   checkInitialized();
   return getRuntime().newBoolean(data.closedWrite);
 }
 /* rb: readable */
 private void checkReadable() {
   checkInitialized();
   if (data.closedRead || !data.modes.isReadable()) {
     throw getRuntime().newIOError("not opened for reading");
   }
 }
 /* rb: check_modifiable */
 @Override
 public void checkFrozen() {
   checkInitialized();
   if (data.internal.isFrozen()) throw getRuntime().newIOError("not modifiable string");
 }