Add throws IndexOutOfBoundsException buffer warning

This commit is contained in:
themode 2024-08-30 23:55:56 +02:00 committed by Matt Worzala
parent 879942e6ab
commit dd1b584cd2
2 changed files with 6 additions and 6 deletions

View File

@ -103,13 +103,13 @@ public sealed interface NetworkBuffer permits NetworkBufferImpl {
return new NetworkBufferTypeImpl.LazyType<>(supplier);
}
<T> void write(@NotNull Type<T> type, @UnknownNullability T value);
<T> void write(@NotNull Type<T> type, @UnknownNullability T value) throws IndexOutOfBoundsException;
<T> @UnknownNullability T read(@NotNull Type<T> type);
<T> @UnknownNullability T read(@NotNull Type<T> type) throws IndexOutOfBoundsException;
<T> void writeAt(long index, @NotNull Type<T> type, @UnknownNullability T value);
<T> void writeAt(long index, @NotNull Type<T> type, @UnknownNullability T value) throws IndexOutOfBoundsException;
<T> @UnknownNullability T readAt(long index, @NotNull Type<T> type);
<T> @UnknownNullability T readAt(long index, @NotNull Type<T> type) throws IndexOutOfBoundsException;
void copyTo(long srcOffset, byte @NotNull [] dest, long destOffset, long length);

View File

@ -159,14 +159,14 @@ final class NetworkBufferImpl implements NetworkBuffer {
public long advanceWrite(long length) {
final long oldWriteIndex = writeIndex;
writeIndex += length;
writeIndex = oldWriteIndex + length;
return oldWriteIndex;
}
@Override
public long advanceRead(long length) {
final long oldReadIndex = readIndex;
readIndex += length;
readIndex = oldReadIndex + length;
return oldReadIndex;
}