public class IospHelper extends Object
Constructor and Description |
---|
IospHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean[] |
convertByteToBoolean(byte[] from) |
static char[] |
convertByteToChar(byte[] byteArray) |
static char[] |
convertByteToCharUTF(byte[] byteArray) |
static byte[] |
convertCharToByte(char[] from) |
static byte[] |
convertCharToByteUTF(char[] from) |
static long |
copyToByteChannel(Array data,
WritableByteChannel channel)
Copy data to a channel.
|
static long |
copyToOutputStream(Array data,
OutputStream out)
Copy data to a OutputStream.
|
static Object |
makePrimitiveArray(int size,
DataType dataType)
Create 1D primitive array of the given size and type
|
static Object |
makePrimitiveArray(int size,
DataType dataType,
Object fillValue)
Create 1D primitive array of the given size and type, fill it with the given value
|
static Object |
readData(LayoutBB layout,
DataType dataType,
Object arr)
Read data subset from ByteBuffer, place in given primitive array.
|
static Object |
readData(ucar.unidata.io.PositioningDataInputStream raf,
Layout index,
DataType dataType,
Object arr)
Read data subset from PositioningDataInputStream, place in given primitive array.
|
static Object |
readData(RandomAccessFile raf,
Layout layout,
DataType dataType,
Object arr,
int byteOrder,
boolean convertChar)
Read data subset from RandomAccessFile, place in given primitive array.
|
static Object |
readDataFill(LayoutBB layout,
DataType dataType,
Object fillValue)
Read data subset from ByteBuffer, create primitive array of size Layout.getTotalNelems.
|
static Object |
readDataFill(ucar.unidata.io.PositioningDataInputStream is,
Layout index,
DataType dataType,
Object fillValue)
Read data subset from PositioningDataInputStream, create primitive array of size Layout.getTotalNelems.
|
static Object |
readDataFill(RandomAccessFile raf,
Layout index,
DataType dataType,
Object fillValue,
int byteOrder)
Read data subset from RandomAccessFile, create primitive array of size Layout.getTotalNelems.
|
static Object |
readDataFill(RandomAccessFile raf,
Layout index,
DataType dataType,
Object fillValue,
int byteOrder,
boolean convertChar) |
static Array |
readSection(ParsedSectionSpec cer) |
static long |
transferData(Array result,
WritableByteChannel channel) |
public static boolean[] convertByteToBoolean(byte[] from)
public static char[] convertByteToChar(byte[] byteArray)
public static char[] convertByteToCharUTF(byte[] byteArray)
public static byte[] convertCharToByte(char[] from)
public static byte[] convertCharToByteUTF(char[] from)
public static long copyToByteChannel(Array data, WritableByteChannel channel) throws IOException
data
- copy from herechannel
- copy to hereIOException
- on write errorpublic static long copyToOutputStream(Array data, OutputStream out) throws IOException
data
- copy from hereout
- copy to hereIOException
- on write errorpublic static Object makePrimitiveArray(int size, DataType dataType)
size
- the size of the array to createdataType
- dataType of the variablepublic static Object makePrimitiveArray(int size, DataType dataType, Object fillValue)
size
- the size of the array to createdataType
- dataType of the variablefillValue
- must be Number if dataType.isNumeric(), or String for STRING, byte[] for Structure, or null for
nonepublic static Object readData(LayoutBB layout, DataType dataType, Object arr)
layout
- handles skipping around in the file, privide ByteBuffer to read fromdataType
- dataType of the variablearr
- primitive array to read data intopublic static Object readData(ucar.unidata.io.PositioningDataInputStream raf, Layout index, DataType dataType, Object arr) throws IOException
raf
- read from here.index
- handles skipping around in the file.dataType
- dataType of the variablearr
- primitive array to read data intoIOException
- on read errorpublic static Object readData(RandomAccessFile raf, Layout layout, DataType dataType, Object arr, int byteOrder, boolean convertChar) throws IOException
raf
- read from here.layout
- handles skipping around in the file.dataType
- dataType of the variablearr
- primitive array to read data intobyteOrder
- if equal to RandomAccessFile.ORDER_XXXX, set the byte order just before readingconvertChar
- true if bytes should be converted to char for dataType CHARIOException
- on read errorpublic static Object readDataFill(LayoutBB layout, DataType dataType, Object fillValue)
layout
- handles skipping around in the file, provide ByteBuffer to read fromdataType
- dataType of the variablefillValue
- must be Number if dataType.isNumeric(), or String for STRING, byte[] for Structure, or null for
nonepublic static Object readDataFill(ucar.unidata.io.PositioningDataInputStream is, Layout index, DataType dataType, Object fillValue) throws IOException
is
- read from here.index
- handles skipping around in the file.dataType
- dataType of the variablefillValue
- must be Number if dataType.isNumeric(), or String for STRING, byte[] for Structure, or null for
noneIOException
- on read errorpublic static Object readDataFill(RandomAccessFile raf, Layout index, DataType dataType, Object fillValue, int byteOrder) throws IOException
raf
- read from here.index
- handles skipping around in the file.dataType
- dataType of the variablefillValue
- must be Number if dataType.isNumeric(), or String for STRING, byte[] for Structure, or null for
nonebyteOrder
- if equal to RandomAccessFile.ORDER_XXXX, set the byte order just before readingIOException
- on read errorpublic static Object readDataFill(RandomAccessFile raf, Layout index, DataType dataType, Object fillValue, int byteOrder, boolean convertChar) throws IOException
IOException
public static Array readSection(ParsedSectionSpec cer) throws IOException, InvalidRangeException
IOException
InvalidRangeException
public static long transferData(Array result, WritableByteChannel channel) throws IOException
IOException