Class ByteBufferAccess
java.lang.Object
net.imglib2.img.basictypeaccess.nio.AbstractBufferAccess<ByteBufferAccess, ByteBuffer>
net.imglib2.img.basictypeaccess.nio.ByteBufferAccess
- All Implemented Interfaces:
Serializable, ArrayDataAccess<ByteBufferAccess>, ByteAccess, DataAccess, BufferAccess<ByteBufferAccess>, VolatileAccess, VolatileByteAccess
public class ByteBufferAccess
extends AbstractBufferAccess<ByteBufferAccess, ByteBuffer>
implements VolatileByteAccess
Access for
ByteBuffer- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final longAutomatically generatedFields inherited from class AbstractBufferAccess
buffer, DEFAULT_IS_VALID -
Constructor Summary
ConstructorsConstructorDescriptionByteBufferAccess(int numEntities) ByteBufferAccess(int numEntities, boolean isValid) ByteBufferAccess(ByteBuffer buffer, boolean isValid) -
Method Summary
Modifier and TypeMethodDescription(package private) ByteBufferduplicateBuffer(ByteBuffer buffer) Call Buffer.duplicate() Buffer.duplicate() only exists in the interface since Java 9 https://docs.oracle.com/javase/9/docs/api/java/nio/Buffer.html#duplicate--static ByteBufferAccessfromByteBuffer(ByteBuffer buffer, boolean isValid) Create a new ByteBufferAccess from a ByteBufferintGet number of bytes for one entity in thisBufferAccess.bytegetValue(int index) getValues(AbstractByteArray<?> array) Copy values into aAbstractByteArray.getValues(AbstractByteArray<?> array, int offset, int length) Copy values into aAbstractByteArray.newInstance(ByteBuffer buffer, boolean isValid) Create a new instance of this class given a Buffer of the same type.voidsetValue(int index, byte value) setValues(AbstractByteArray<?> array) Copy values from aAbstractByteArray.setValues(AbstractByteArray<?> array, int offset, int length) Copy values from aAbstractByteArray.setValues(ByteBufferAccess access) Copy values from another ByteBufferAccess.Methods inherited from class AbstractBufferAccess
allocate, allocate, allocateByteBuffer, createArray, createView, getArrayLength, getCurrentStorageArray, isDirect, isReadOnly, isValidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataAccess
createViewMethods inherited from interface VolatileAccess
isValid
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDAutomatically generated- See Also:
-
NUM_BYTES_PER_ENTITY
private static final int NUM_BYTES_PER_ENTITY- See Also:
-
-
Constructor Details
-
ByteBufferAccess
-
ByteBufferAccess
public ByteBufferAccess(int numEntities, boolean isValid) -
ByteBufferAccess
public ByteBufferAccess(int numEntities) -
ByteBufferAccess
public ByteBufferAccess()
-
-
Method Details
-
getValue
public byte getValue(int index) - Specified by:
getValuein interfaceByteAccess
-
setValue
public void setValue(int index, byte value) - Specified by:
setValuein interfaceByteAccess
-
getNumBytesPerEntity
public int getNumBytesPerEntity()Description copied from interface:BufferAccessGet number of bytes for one entity in thisBufferAccess. This usually retrieves a static field.- Specified by:
getNumBytesPerEntityin interfaceBufferAccess<ByteBufferAccess>- Returns:
- number of bytes
-
newInstance
Description copied from class:AbstractBufferAccessCreate a new instance of this class given a Buffer of the same type.- Specified by:
newInstancein interfaceBufferAccess<ByteBufferAccess>- Specified by:
newInstancein classAbstractBufferAccess<ByteBufferAccess, ByteBuffer>- Parameters:
buffer-isValid-- Returns:
-
duplicateBuffer
Description copied from class:AbstractBufferAccessCall Buffer.duplicate() Buffer.duplicate() only exists in the interface since Java 9 https://docs.oracle.com/javase/9/docs/api/java/nio/Buffer.html#duplicate--- Specified by:
duplicateBufferin classAbstractBufferAccess<ByteBufferAccess, ByteBuffer>- Returns:
-
fromByteBuffer
Create a new ByteBufferAccess from a ByteBuffer- Parameters:
buffer-isValid-- Returns:
-
getValues
Copy values into aAbstractByteArray.- Parameters:
array-- Returns:
- See Also:
-
getValues
Copy values into aAbstractByteArray.- Parameters:
array-offset-length-- Returns:
- See Also:
-
setValues
Copy values from aAbstractByteArray.- Parameters:
array-- Returns:
- See Also:
-
setValues
Copy values from aAbstractByteArray.- Parameters:
array-offset-length-- Returns:
- See Also:
-
setValues
Copy values from another ByteBufferAccess.- Parameters:
access-- Returns:
-