Package nom.tam.util.type
Class PrimitiveTypeBase<B extends java.nio.Buffer>
- java.lang.Object
-
- nom.tam.util.type.PrimitiveTypeBase<B>
-
- All Implemented Interfaces:
PrimitiveType<B>
- Direct Known Subclasses:
BooleanType
,ByteType
,CharType
,DoubleType
,FloatType
,IntType
,LongType
,ShortType
,StringType
,UnknownType
abstract class PrimitiveTypeBase<B extends java.nio.Buffer> extends java.lang.Object implements PrimitiveType<B>
-
-
Field Summary
Fields Modifier and Type Field Description private int
bitPix
private java.lang.Class<B>
bufferClass
static int
COPY_BLOCK_SIZE
private boolean
individualSize
private java.lang.Class<?>
primitiveClass
private int
size
private char
type
private java.lang.Class<?>
wrapperClass
-
Constructor Summary
Constructors Modifier Constructor Description protected
PrimitiveTypeBase(int size, boolean individualSize, java.lang.Class<?> primitiveClass, java.lang.Class<?> wrapperClass, java.lang.Class<B> bufferClass, char type, int bitPix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendBuffer(B buffer, B dataToAppend)
void
appendToByteBuffer(java.nio.ByteBuffer byteBuffer, B dataToAppend)
B
asTypedBuffer(java.nio.ByteBuffer buffer)
int
bitPix()
java.lang.Class<B>
bufferClass()
java.nio.ByteBuffer
convertToByteBuffer(java.lang.Object array)
void
getArray(B buffer, java.lang.Object array)
void
getArray(B buffer, java.lang.Object array, int length)
void
getArray(B buffer, java.lang.Object array, int offset, int length)
boolean
individualSize()
boolean
is(PrimitiveType<? extends java.nio.Buffer> other)
java.lang.Object
newArray(int length)
B
newBuffer(int length)
B
newBuffer(long length)
java.lang.Class<?>
primitiveClass()
void
putArray(B buffer, java.lang.Object array)
void
putArray(B buffer, java.lang.Object array, int length)
int
size()
int
size(java.lang.Object instance)
currently the only individual size primitive so, keep it simpleB
sliceBuffer(B buffer)
char
type()
B
wrap(java.lang.Object array)
java.lang.Class<?>
wrapperClass()
-
-
-
Field Detail
-
COPY_BLOCK_SIZE
public static final int COPY_BLOCK_SIZE
- See Also:
- Constant Field Values
-
bitPix
private final int bitPix
-
bufferClass
private final java.lang.Class<B extends java.nio.Buffer> bufferClass
-
individualSize
private final boolean individualSize
-
primitiveClass
private final java.lang.Class<?> primitiveClass
-
size
private final int size
-
type
private final char type
-
wrapperClass
private final java.lang.Class<?> wrapperClass
-
-
Constructor Detail
-
PrimitiveTypeBase
protected PrimitiveTypeBase(int size, boolean individualSize, java.lang.Class<?> primitiveClass, java.lang.Class<?> wrapperClass, java.lang.Class<B> bufferClass, char type, int bitPix)
-
-
Method Detail
-
appendBuffer
public void appendBuffer(B buffer, B dataToAppend)
- Specified by:
appendBuffer
in interfacePrimitiveType<B extends java.nio.Buffer>
-
appendToByteBuffer
public void appendToByteBuffer(java.nio.ByteBuffer byteBuffer, B dataToAppend)
- Specified by:
appendToByteBuffer
in interfacePrimitiveType<B extends java.nio.Buffer>
-
asTypedBuffer
public B asTypedBuffer(java.nio.ByteBuffer buffer)
- Specified by:
asTypedBuffer
in interfacePrimitiveType<B extends java.nio.Buffer>
-
bitPix
public int bitPix()
- Specified by:
bitPix
in interfacePrimitiveType<B extends java.nio.Buffer>
-
bufferClass
public java.lang.Class<B> bufferClass()
- Specified by:
bufferClass
in interfacePrimitiveType<B extends java.nio.Buffer>
-
convertToByteBuffer
public java.nio.ByteBuffer convertToByteBuffer(java.lang.Object array)
- Specified by:
convertToByteBuffer
in interfacePrimitiveType<B extends java.nio.Buffer>
-
getArray
public final void getArray(B buffer, java.lang.Object array)
- Specified by:
getArray
in interfacePrimitiveType<B extends java.nio.Buffer>
-
getArray
public final void getArray(B buffer, java.lang.Object array, int length)
- Specified by:
getArray
in interfacePrimitiveType<B extends java.nio.Buffer>
-
getArray
public void getArray(B buffer, java.lang.Object array, int offset, int length)
- Specified by:
getArray
in interfacePrimitiveType<B extends java.nio.Buffer>
-
individualSize
public boolean individualSize()
- Specified by:
individualSize
in interfacePrimitiveType<B extends java.nio.Buffer>
-
is
public boolean is(PrimitiveType<? extends java.nio.Buffer> other)
- Specified by:
is
in interfacePrimitiveType<B extends java.nio.Buffer>
-
newArray
public java.lang.Object newArray(int length)
- Specified by:
newArray
in interfacePrimitiveType<B extends java.nio.Buffer>
-
newBuffer
public final B newBuffer(int length)
- Specified by:
newBuffer
in interfacePrimitiveType<B extends java.nio.Buffer>
-
newBuffer
public final B newBuffer(long length)
- Specified by:
newBuffer
in interfacePrimitiveType<B extends java.nio.Buffer>
-
primitiveClass
public java.lang.Class<?> primitiveClass()
- Specified by:
primitiveClass
in interfacePrimitiveType<B extends java.nio.Buffer>
-
putArray
public final void putArray(B buffer, java.lang.Object array)
- Specified by:
putArray
in interfacePrimitiveType<B extends java.nio.Buffer>
-
putArray
public void putArray(B buffer, java.lang.Object array, int length)
- Specified by:
putArray
in interfacePrimitiveType<B extends java.nio.Buffer>
-
size
public int size()
- Specified by:
size
in interfacePrimitiveType<B extends java.nio.Buffer>
-
size
public int size(java.lang.Object instance)
currently the only individual size primitive so, keep it simple- Specified by:
size
in interfacePrimitiveType<B extends java.nio.Buffer>
- Parameters:
instance
- the object to calculate the size- Returns:
- the size in bytes of the object instance
-
sliceBuffer
public B sliceBuffer(B buffer)
- Specified by:
sliceBuffer
in interfacePrimitiveType<B extends java.nio.Buffer>
-
type
public char type()
- Specified by:
type
in interfacePrimitiveType<B extends java.nio.Buffer>
-
wrap
public B wrap(java.lang.Object array)
- Specified by:
wrap
in interfacePrimitiveType<B extends java.nio.Buffer>
-
wrapperClass
public java.lang.Class<?> wrapperClass()
- Specified by:
wrapperClass
in interfacePrimitiveType<B extends java.nio.Buffer>
-
-