Here you can find the source of assertBounds(final long reqOff, final long reqLen, final long allocSize)
Parameter | Description |
---|---|
reqOff | the requested offset |
reqLen | the requested length |
allocSize | the allocated size. |
static void assertBounds(final long reqOff, final long reqLen, final long allocSize)
//package com.java2s; /*/*from ww w. ja v a 2 s . c o m*/ * Copyright 2015, Yahoo! Inc. * Licensed under the terms of the Apache License 2.0. See LICENSE file at the project root for terms. */ public class Main { /** * Perform bounds checking using java assert (if enabled) checking the requested offset and length * against the allocated size. If any of the parameters are negative the assert will be thrown. * @param reqOff the requested offset * @param reqLen the requested length * @param allocSize the allocated size. */ static void assertBounds(final long reqOff, final long reqLen, final long allocSize) { assert ((reqOff | reqLen | (reqOff + reqLen) | (allocSize - (reqOff + reqLen))) >= 0) : "offset: " + reqOff + ", reqLength: " + reqLen + ", size: " + allocSize; } }