public static Pointer to(Buffer buffer)
    {
        if (buffer == null || (!buffer.isDirect() && !buffer.hasArray()))
        {
            throw new IllegalArgumentException(
                "Buffer may not be null and must have an array or be direct");
        }
        return new Pointer(buffer);
    }
public static Pointer to ( Buffer buffer ) { if ( buffer == null || ( ! buffer . isDirect ( ) && ! buffer . hasArray ( ) ) ) { throw new IllegalArgumentException ( "Buffer may not be null and must have an array or be direct" ) ; } return new Pointer ( buffer ) ; }
<b>NOTE:</b> This method does not take into account the position
and array offset of the given buffer. In order to create a
pointer that takes the position and array offset into account,
use the {@link #toBuffer(Buffer)} method. <br />
<br />

If the given buffer has a backing array, then the returned
pointer will in any case point to the start of the array,
even if the buffer has been created using the <code>slice</code>
method (like {@link ByteBuffer#slice()}). If the buffer is
direct, then this method will return a Pointer to the address
of the direct buffer. If the buffer has been created using the
<code>slice</code> method, then this will be the actual start
of the slice. Although this implies a different treatment of
direct- and non direct buffers, the method is kept for
backward compatibility. <br />
<br />
In both cases, for direct and array-based buffers, this method
does not take into account the position of the given buffer. <br />
<br />
The buffer must not be null, and either be a direct buffer, or
have a backing array

@param buffer The buffer the pointer should point to
@return The pointer
@throws IllegalArgumentException If the given buffer
is null or is neither direct nor has a backing array