Example usage for java.nio BufferOverflowException BufferOverflowException

List of usage examples for java.nio BufferOverflowException BufferOverflowException

Introduction

In this page you can find the example usage for java.nio BufferOverflowException BufferOverflowException.

Prototype

public BufferOverflowException() 

Source Link

Document

Constructs a BufferOverflowException.

Usage

From source file:ome.io.nio.RomioPixelBuffer.java

/**
 * Implemented as specified by {@link PixelBuffer} I/F.
 * @see PixelBuffer#setPlane(ByteBuffer, Integer, Integer, Integer)
*/// w ww . j a  v a  2  s  . co  m
public void setPlane(ByteBuffer buffer, Integer z, Integer c, Integer t)
        throws IOException, DimensionsOutOfBoundsException {
    throwIfReadOnly();
    Long offset = getPlaneOffset(z, c, t);
    Integer size = getPlaneSize();
    if (buffer.limit() != size) {
        // Handle the size mismatch.
        if (buffer.limit() < size)
            throw new BufferUnderflowException();
        throw new BufferOverflowException();
    }

    setRegion(size, offset, buffer);
}

From source file:ome.io.nio.RomioPixelBuffer.java

/**
 * Implemented as specified by {@link PixelBuffer} I/F.
 * @see PixelBuffer#setStack(ByteBuffer, Integer, Integer, Integer)
*/// w  ww .j a va2 s. c om
public void setStack(ByteBuffer buffer, Integer z, Integer c, Integer t)
        throws IOException, DimensionsOutOfBoundsException {
    throwIfReadOnly();
    Long offset = getStackOffset(c, t);
    Integer size = getStackSize();
    if (buffer.limit() != size) {
        // Handle the size mismatch.
        if (buffer.limit() < size)
            throw new BufferUnderflowException();
        throw new BufferOverflowException();
    }

    setRegion(size, offset, buffer);
}

From source file:ome.io.nio.RomioPixelBuffer.java

/**
 * Implemented as specified by {@link PixelBuffer} I/F.
 * @see PixelBuffer#setTimepoint(ByteBuffer, Integer)
*///  w  w  w.  j  a  v  a 2 s .com
public void setTimepoint(ByteBuffer buffer, Integer t) throws IOException, DimensionsOutOfBoundsException {
    throwIfReadOnly();
    Long offset = getTimepointOffset(t);
    Integer size = getTimepointSize();
    if (buffer.limit() != size) {
        // Handle the size mismatch.
        if (buffer.limit() < size)
            throw new BufferUnderflowException();
        throw new BufferOverflowException();
    }

    setRegion(size, offset, buffer);
}