예제 #1
0
  /* 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)
  }
예제 #2
0
  @JRubyMethod
  @Override
  public IRubyObject close() {
    checkInitialized();
    checkOpen();

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

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