jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Classes | Static Public Member Functions | Static Public Attributes | List of all members
org.jau.io.Buffers Class Reference

Utility methods allowing easy java.nio.Buffer manipulations. More...

Collaboration diagram for org.jau.io.Buffers:

Classes

class  Cleaner
 Access to NIO sun.misc.Cleaner, allowing caller to deterministically clean a given sun.nio.ch.DirectBuffer. More...
 

Static Public Member Functions

static ByteBuffer newDirectByteBuffer (final int size)
 Allocates a new direct ByteBuffer with the specified number of elements. More...
 
static ByteBuffer nativeOrder (final ByteBuffer buf)
 Helper routine to set a ByteBuffer to the native byte order, if that operation is supported by the underlying NIO implementation. More...
 
static boolean isDirect (final Object buf)
 Helper routine to tell whether a buffer is direct or not. More...
 
static long getDirectBufferByteOffset (final Object buf)
 Helper routine to get the Buffer byte offset by taking into account the Buffer position and the underlying type. More...
 
static long getDirectBufferByteLimit (final Object buf)
 Helper routine to get the Buffer byte limit by taking into account the Buffer limit and the underlying type. More...
 

Static Public Attributes

static final int SIZEOF_BYTE = 1
 
static final int SIZEOF_SHORT = 2
 
static final int SIZEOF_CHAR = 2
 
static final int SIZEOF_INT = 4
 
static final int SIZEOF_FLOAT = 4
 
static final int SIZEOF_LONG = 8
 
static final int SIZEOF_DOUBLE = 8
 

Detailed Description

Utility methods allowing easy java.nio.Buffer manipulations.

Definition at line 43 of file Buffers.java.

Member Function Documentation

◆ getDirectBufferByteLimit()

static long org.jau.io.Buffers.getDirectBufferByteLimit ( final Object  buf)
static

Helper routine to get the Buffer byte limit by taking into account the Buffer limit and the underlying type.

This is the total limit for Direct Buffers.

Return value is of type long only to cover the int multiple of the position and element type size.
For ByteBuffer, the return value can be safely cast to int.

Definition at line 129 of file Buffers.java.

Here is the caller graph for this function:

◆ getDirectBufferByteOffset()

static long org.jau.io.Buffers.getDirectBufferByteOffset ( final Object  buf)
static

Helper routine to get the Buffer byte offset by taking into account the Buffer position and the underlying type.

This is the total offset for Direct Buffers.

Return value is of type long only to cover the int multiple of the position and element type size.
For ByteBuffer, the return value can be safely cast to int.

Definition at line 96 of file Buffers.java.

Here is the caller graph for this function:

◆ isDirect()

static boolean org.jau.io.Buffers.isDirect ( final Object  buf)
static

Helper routine to tell whether a buffer is direct or not.

Null pointers are considered direct.

Definition at line 78 of file Buffers.java.

Here is the caller graph for this function:

◆ nativeOrder()

static ByteBuffer org.jau.io.Buffers.nativeOrder ( final ByteBuffer  buf)
static

Helper routine to set a ByteBuffer to the native byte order, if that operation is supported by the underlying NIO implementation.

Definition at line 70 of file Buffers.java.

◆ newDirectByteBuffer()

static ByteBuffer org.jau.io.Buffers.newDirectByteBuffer ( final int  size)
static

Allocates a new direct ByteBuffer with the specified number of elements.

The returned buffer will have its byte order set to the host platform's native byte order.

Definition at line 61 of file Buffers.java.

Here is the caller graph for this function:

Member Data Documentation

◆ SIZEOF_BYTE

final int org.jau.io.Buffers.SIZEOF_BYTE = 1
static

Definition at line 46 of file Buffers.java.

◆ SIZEOF_CHAR

final int org.jau.io.Buffers.SIZEOF_CHAR = 2
static

Definition at line 48 of file Buffers.java.

◆ SIZEOF_DOUBLE

final int org.jau.io.Buffers.SIZEOF_DOUBLE = 8
static

Definition at line 52 of file Buffers.java.

◆ SIZEOF_FLOAT

final int org.jau.io.Buffers.SIZEOF_FLOAT = 4
static

Definition at line 50 of file Buffers.java.

◆ SIZEOF_INT

final int org.jau.io.Buffers.SIZEOF_INT = 4
static

Definition at line 49 of file Buffers.java.

◆ SIZEOF_LONG

final int org.jau.io.Buffers.SIZEOF_LONG = 8
static

Definition at line 51 of file Buffers.java.

◆ SIZEOF_SHORT

final int org.jau.io.Buffers.SIZEOF_SHORT = 2
static

Definition at line 47 of file Buffers.java.


The documentation for this class was generated from the following file: