Class InvalidBufferOffsetException
- All Implemented Interfaces:
Serializable
- Since:
- 21.1
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic InvalidBufferOffsetException
create
(long byteOffset, long length) Creates anInvalidBufferOffsetException
to indicate that a buffer access is invalid.static InvalidBufferOffsetException
Creates anInvalidBufferOffsetException
to indicate that a buffer access is invalid.long
Returns the start byte offset of the invalid access from the start of the buffer.long
Returns the length of the accessed memory region in bytes starting fromthe start byte offset
.Methods inherited from class InteropException
fillInStackTrace, getCause, initCause
Methods inherited from class Throwable
addSuppressed, getLocalizedMessage, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
getByteOffset
public long getByteOffset()Returns the start byte offset of the invalid access from the start of the buffer.- Since:
- 21.1
-
getLength
public long getLength()Returns the length of the accessed memory region in bytes starting fromthe start byte offset
.- Since:
- 21.1
-
getMessage
- Overrides:
getMessage
in classThrowable
- Since:
- 21.1
-
create
Creates anInvalidBufferOffsetException
to indicate that a buffer access is invalid.This method is designed to be used in
compiled
code paths.- Parameters:
byteOffset
- the start byteOffset of the invalid accesslength
- the length of the accessed memory region in bytes starting frombyteOffset
- Since:
- 21.1
-
create
Creates anInvalidBufferOffsetException
to indicate that a buffer access is invalid.In addition a cause may be provided. The cause should only be set if the guest language code caused this problem. An example for this is a language specific proxy mechanism that invokes guest language code to describe an object. If the guest language code fails to execute and this interop exception is a valid interpretation of the error, then the error should be provided as cause. The cause can then be used by the source language as new exception cause if the
InteropException
is translated to a source language error. If theInteropException
is discarded, then the cause will most likely get discarded by the source language as well. Note that the cause must be of typeAbstractTruffleException
otherwise anIllegalArgumentException
is thrown.This method is designed to be used in
compiled
code paths.- Parameters:
byteOffset
- the start byteOffset of the invalid accesslength
- the length of the accessed memory region in bytes starting frombyteOffset
.cause
- the guest language exception that caused the error.- Since:
- 21.1
-