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 Summary

    Modifier and Type
    Method
    Description
    Returns an NIO buffer.
    boolean
    Indicates whether the buffer, when created, will be read-only or not.
    void
    Releases the NIO buffer.
  • Method Details

    • 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

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

      void releaseBuffer() throws 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:
      IOException - if something goes wrong