Interface NioArrayImpl.BufferGetter

  • Enclosing class:
    NioArrayImpl

    public static interface NioArrayImpl.BufferGetter
    Defines an object which can provide deferred access to a Buffer. Can be used to provide access to a buffer which will only be created on demand; if it is never required it will never be created.
    • Method Detail

      • isReadOnly

        boolean isReadOnly()
        Indicates whether the buffer, when created, will be read-only or not.
        Returns:
        true if the buffer created by getBuffer will be read-only
      • getBuffer

        java.nio.Buffer getBuffer()
                           throws java.io.IOException
        Returns an NIO buffer. Will be called a maximum of once.
        Returns:
        the deferred-access NIO buffer.
        Throws:
        java.io.IOException - if something goes wrong
      • releaseBuffer

        void releaseBuffer()
                    throws java.io.IOException
        Releases the NIO buffer. Ought to be called when this object, and the buffer it provides, are no longer required. Will only be called if getBuffer has been called. It cannot be guaranteed however that this method will be called.
        Throws:
        java.io.IOException - if something goes wrong