src/main/java/org/nustaq/offheap/BinaryQueue.java
public long poll(ByteSink destination, long destoff, long destlen) {
        long count = 0;
        try {
            while (pollIndex != addIndex && count < destlen) {
                destination.put(destoff + count++, storage.get(pollIndex++));
                if (pollIndex >= storage.length()) {
                    pollIndex = 0;
                }
            }
        } catch (Exception e) {
            logger.log(FSTLogger.Level.ERROR, "Failed to poll", e);
        }
        return count;
    }
public long poll(ByteSink destination, long destoff, long destlen) {
        long count = 0;
        try {
            while (pollIndex != addIndex && count < destlen) {
                destination.put(destoff + count++, storage.get(pollIndex++));
                if (pollIndex >= storage.length()) {
                    pollIndex = 0;
                }
            }
        } catch (Exception e) {
            logger.log(FSTLogger.Level.ERROR, "Failed to poll", e);
        }
        return count;
    }
read up to destlen bytes (if available).
Note you can use HeapBytez (implements ByteSink) in order to read to a regular byte array.
HeapBytez wrapper can be reused to avoid unnecessary allocation.
Also possible is ByteBufferBasicBytes to read into a ByteBuffer and MallocBytes or MMFBytes to
read into Unsafe alloc'ed off heap memory or persistent mem mapped memory regions.

@param destination
@param destoff
@param destlen
@return