Class ByteBufferAccess
- java.lang.Object
-
- net.imglib2.img.basictypeaccess.nio.AbstractBufferAccess<ByteBufferAccess,java.nio.ByteBuffer>
-
- net.imglib2.img.basictypeaccess.nio.ByteBufferAccess
-
- All Implemented Interfaces:
java.io.Serializable,ArrayDataAccess<ByteBufferAccess>,ByteAccess,DataAccess,BufferAccess<ByteBufferAccess>,VolatileAccess,VolatileByteAccess
public class ByteBufferAccess extends AbstractBufferAccess<ByteBufferAccess,java.nio.ByteBuffer> implements VolatileByteAccess
Access forByteBuffer- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static intNUM_BYTES_PER_ENTITYprivate static longserialVersionUIDAutomatically generated-
Fields inherited from class net.imglib2.img.basictypeaccess.nio.AbstractBufferAccess
buffer, DEFAULT_IS_VALID
-
-
Constructor Summary
Constructors Constructor Description ByteBufferAccess()ByteBufferAccess(int numEntities)ByteBufferAccess(int numEntities, boolean isValid)ByteBufferAccess(java.nio.ByteBuffer buffer, boolean isValid)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.nio.ByteBufferduplicateBuffer(java.nio.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(java.nio.ByteBuffer buffer, boolean isValid)Create a new ByteBufferAccess from a ByteBufferintgetNumBytesPerEntity()Get number of bytes for one entity in thisBufferAccess.bytegetValue(int index)java.nio.ByteBuffergetValues(AbstractByteArray<?> array)Copy values into aAbstractByteArray.java.nio.ByteBuffergetValues(AbstractByteArray<?> array, int offset, int length)Copy values into aAbstractByteArray.ByteBufferAccessnewInstance(java.nio.ByteBuffer buffer, boolean isValid)Create a new instance of this class given a Buffer of the same type.voidsetValue(int index, byte value)java.nio.ByteBuffersetValues(AbstractByteArray<?> array)Copy values from aAbstractByteArray.java.nio.ByteBuffersetValues(AbstractByteArray<?> array, int offset, int length)Copy values from aAbstractByteArray.java.nio.ByteBuffersetValues(ByteBufferAccess access)Copy values from another ByteBufferAccess.-
Methods inherited from class net.imglib2.img.basictypeaccess.nio.AbstractBufferAccess
allocate, allocate, allocateByteBuffer, createArray, createView, getArrayLength, getCurrentStorageArray, isDirect, isReadOnly, isValid
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.imglib2.img.basictypeaccess.DataAccess
createView
-
Methods inherited from interface net.imglib2.img.basictypeaccess.volatiles.VolatileAccess
isValid
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Automatically generated- See Also:
- Constant Field Values
-
NUM_BYTES_PER_ENTITY
private static final int NUM_BYTES_PER_ENTITY
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
public ByteBufferAccess newInstance(java.nio.ByteBuffer buffer, boolean isValid)
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,java.nio.ByteBuffer>- Returns:
-
duplicateBuffer
java.nio.ByteBuffer duplicateBuffer(java.nio.ByteBuffer buffer)
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,java.nio.ByteBuffer>- Returns:
-
fromByteBuffer
public static ByteBufferAccess fromByteBuffer(java.nio.ByteBuffer buffer, boolean isValid)
Create a new ByteBufferAccess from a ByteBuffer- Parameters:
buffer-isValid-- Returns:
-
getValues
public java.nio.ByteBuffer getValues(AbstractByteArray<?> array)
Copy values into aAbstractByteArray.- Parameters:
array-- Returns:
- See Also:
ByteBuffer.get(byte[])
-
getValues
public java.nio.ByteBuffer getValues(AbstractByteArray<?> array, int offset, int length)
Copy values into aAbstractByteArray.- Parameters:
array-offset-length-- Returns:
- See Also:
ByteBuffer.get(byte[], int, int)
-
setValues
public java.nio.ByteBuffer setValues(AbstractByteArray<?> array)
Copy values from aAbstractByteArray.- Parameters:
array-- Returns:
- See Also:
ByteBuffer.put(byte[])
-
setValues
public java.nio.ByteBuffer setValues(AbstractByteArray<?> array, int offset, int length)
Copy values from aAbstractByteArray.- Parameters:
array-offset-length-- Returns:
- See Also:
ByteBuffer.put(byte[], int, int)
-
setValues
public java.nio.ByteBuffer setValues(ByteBufferAccess access)
Copy values from another ByteBufferAccess.- Parameters:
access-- Returns:
-
-