Example usage for org.apache.commons.collections BufferUnderflowException BufferUnderflowException

List of usage examples for org.apache.commons.collections BufferUnderflowException BufferUnderflowException

Introduction

In this page you can find the example usage for org.apache.commons.collections BufferUnderflowException BufferUnderflowException.

Prototype

public BufferUnderflowException(String message) 

Source Link

Document

Construct a new BufferUnderflowException.

Usage

From source file:org.apache.flink.streaming.api.state.NullableCircularBuffer.java

/**
 * Returns the least recently inserted element in this buffer.
 *
 * @return the least recently inserted element
 * @throws BufferUnderflowException// w  w  w.j  a  v a2 s . c om
 *             if the buffer is empty
 */
public Object get() {
    if (isEmpty()) {
        throw new BufferUnderflowException("The buffer is already empty");
    }

    return elements[start];
}

From source file:org.apache.flink.streaming.api.state.NullableCircularBuffer.java

/**
 * Removes the least recently inserted element from this buffer.
 *
 * @return the least recently inserted element
 * @throws BufferUnderflowException/*from w  w w  .ja v a 2s .  c  om*/
 *             if the buffer is empty
 */
public Object remove() {
    if (isEmpty()) {
        throw new BufferUnderflowException("The buffer is already empty");
    }

    Object element = elements[start];

    elements[start++] = null;

    if (start >= maxElements) {
        start = 0;
    }

    full = false;

    return element;
}

From source file:securitymon.collections.BoundedFifoBuffer.java

/**
 * Removes the least recently inserted element from this buffer.
 *
 * @return the least recently inserted element
 * @throws BufferUnderflowException  if the buffer is empty
 *//*from   www. j a va  2  s .  co m*/
public Object remove() {
    if (isEmpty()) {
        throw new BufferUnderflowException("The buffer is already empty");
    }

    byte element = elements[start];

    elements[start++] = (byte) 0;

    if (start >= maxElements) {
        start = 0;
    }

    full = false;

    return element;
}