Skip to content

Commit

Permalink
Start filling in IO::Buffer logic
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Sep 29, 2023
1 parent 9a23a82 commit a20b099
Show file tree
Hide file tree
Showing 3 changed files with 911 additions and 73 deletions.
40 changes: 36 additions & 4 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -1718,10 +1718,10 @@ private void initExceptions() {
RubyClass runtimeError = this.runtimeError;
ObjectAllocator runtimeErrorAllocator = runtimeError.getAllocator();
bufferLockedError = ioBufferClass.defineClassUnder("LockedError", runtimeError, runtimeErrorAllocator);
ioBufferClass.defineClassUnder("AllocationError", runtimeError, runtimeErrorAllocator);
ioBufferClass.defineClassUnder("AccessError", runtimeError, runtimeErrorAllocator);
ioBufferClass.defineClassUnder("InvalidatedError", runtimeError, runtimeErrorAllocator);
ioBufferClass.defineClassUnder("MaskError", runtimeError, runtimeErrorAllocator);
bufferAllocationError = ioBufferClass.defineClassUnder("AllocationError", runtimeError, runtimeErrorAllocator);
bufferAccessError = ioBufferClass.defineClassUnder("AccessError", runtimeError, runtimeErrorAllocator);
bufferInvalidatedError = ioBufferClass.defineClassUnder("InvalidatedError", runtimeError, runtimeErrorAllocator);
bufferMaskError = ioBufferClass.defineClassUnder("MaskError", runtimeError, runtimeErrorAllocator);

initErrno();

Expand Down Expand Up @@ -2502,6 +2502,22 @@ public RubyClass getBufferLockedError() {
return bufferLockedError;
}

public RubyClass getBufferAllocationError() {
return bufferAllocationError;
}

public RubyClass getBufferAccessError() {
return bufferAccessError;
}

public RubyClass getBufferInvalidatedError() {
return bufferInvalidatedError;
}

public RubyClass getBufferMaskError() {
return bufferMaskError;
}

@Deprecated
RubyRandom.RandomType defaultRand;

Expand Down Expand Up @@ -4267,6 +4283,22 @@ public RaiseException newBufferLockedError(String message) {
return newRaiseException(getBufferLockedError(), message);
}

public RaiseException newBufferAllocationError(String message) {
return newRaiseException(getBufferAllocationError(), message);
}

public RaiseException newBufferAccessError(String message) {
return newRaiseException(getBufferAccessError(), message);
}

public RaiseException newBufferInvalidatedError(String message) {
return newRaiseException(getBufferInvalidatedError(), message);
}

public RaiseException newBufferMaskError(String message) {
return newRaiseException(getBufferMaskError(), message);
}

/**
* Construct a new RaiseException wrapping a new Ruby exception object appropriate to the given exception class.
*
Expand Down
Loading

0 comments on commit a20b099

Please sign in to comment.