Class ChannelDataInput.ShortsReader
java.lang.Object
org.apache.sis.internal.storage.io.ChannelDataInput.ArrayReader
org.apache.sis.internal.storage.io.ChannelDataInput.ShortsReader
- All Implemented Interfaces:
DataTransfer
- Enclosing class:
ChannelDataInput
Reads short integers from the enclosing stream and stores them into the given destination array.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate short[]
The array where to store the values.private ShortBuffer
A view over the enclosing byte buffer. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
createDataArray
(int n) Creates a destination array of the given length.Creates a new buffer of the type required by the array to fill.Returns the data as achar[]
,short[]
,int[]
,long[]
,float[]
ordouble[]
array.ReturnsDataTransfer.dataArray()
wrapped in a buffer.int
Returns the size of the Java primitive type which is the element of the array.void
Sets the destination to the given data array, which may benull
.(package private) void
transfer
(int p, int n) Transfers the data from the buffer created byDataTransfer.createView()
to array of primitive Java type known by the subclass.view()
Returns the view created by the last call toDataTransfer.createView()
, ornull
if none.Methods inherited from class org.apache.sis.internal.storage.io.ChannelDataInput.ArrayReader
filename, readFully, seek
-
Field Details
-
view
A view over the enclosing byte buffer. -
dest
private short[] destThe array where to store the values.
-
-
Constructor Details
-
ShortsReader
ShortsReader(ShortBuffer source) -
ShortsReader
ShortsReader(short[] dest)
-
-
Method Details
-
dataSizeShift
public int dataSizeShift()Description copied from interface:DataTransfer
Returns the size of the Java primitive type which is the element of the array. The size is expressed as the number of bits to shift:java dataSize = 1 << dataSizeShift;
-
dataArray
Description copied from interface:DataTransfer
Returns the data as achar[]
,short[]
,int[]
,long[]
,float[]
ordouble[]
array. This is either the array given in argument to the subclass constructor, or the array created byDataTransfer.createDataArray(int)
. -
dataArrayAsBuffer
Description copied from interface:DataTransfer
ReturnsDataTransfer.dataArray()
wrapped in a buffer. -
view
Description copied from interface:DataTransfer
Returns the view created by the last call toDataTransfer.createView()
, ornull
if none. -
createView
Description copied from interface:DataTransfer
Creates a new buffer of the type required by the array to fill. This method is guaranteed to be invoked exactly once, after theChannelData.buffer
contains enough data. -
createDataArray
public void createDataArray(int n) Description copied from interface:DataTransfer
Creates a destination array of the given length. -
transfer
void transfer(int p, int n) Description copied from class:ChannelDataInput.ArrayReader
Transfers the data from the buffer created byDataTransfer.createView()
to array of primitive Java type known by the subclass. This method may be invoked an arbitrary number of time.- Specified by:
transfer
in classChannelDataInput.ArrayReader
-
setDest
Description copied from interface:DataTransfer
Sets the destination to the given data array, which may benull
.
-