static void assertBuffer(byte[] buffer, long offset, int length) {
        checkNotNull(buffer, "Buffer must be not null!");
        checkArgument(offset >= 0, "Data offset must be positive!");
        checkArgument(length >= 0 && length <= buffer.length, "Length must be in range [0..buffer.length]");
    }
Just simple utils.

@author Alexey Danilov (danikula@gmail.com).
dkplayer-videocache/src/main/java/com/danikula/videocache/ProxyCacheUtils.java