Package uk.ac.starlink.array
Interface NioArrayImpl.BufferGetter
-
- Enclosing class:
- NioArrayImpl
public static interface NioArrayImpl.BufferGetterDefines an object which can provide deferred access to aBuffer. 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.nio.BuffergetBuffer()Returns an NIO buffer.booleanisReadOnly()Indicates whether the buffer, when created, will be read-only or not.voidreleaseBuffer()Releases the NIO buffer.
-
-
-
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.IOExceptionReturns 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.IOExceptionReleases 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
-
-