private void waitForCurrentByteBuffer() {
        if (currentByteBuffer == null
                || currentBufferPosition > currentByteBuffer.length - 1) {
            currentByteBuffer = null;
            while (currentByteBuffer == null && !reachedEndOfStream()) {
                currentByteBuffer = dataQueue.poll();
                currentBufferPosition = 0;
                try {
                    TimeUnit.MILLISECONDS.sleep(5L);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }