public class IospHelper
extends java.lang.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,
java.nio.channels.WritableByteChannel channel)
Copy data to a channel.
|
static long |
copyToOutputStream(Array data,
java.io.OutputStream out)
Copy data to a OutputStream.
|
static java.lang.Object |
makePrimitiveArray(int size,
DataType dataType)
Create 1D primitive array of the given size and type
|
static java.lang.Object |
makePrimitiveArray(int size,
DataType dataType,
java.lang.Object fillValue)
Create 1D primitive array of the given size and type, fill it with the given value
|
static java.lang.Object |
readData(LayoutBB layout,
DataType dataType,
java.lang.Object arr)
Read data subset from ByteBuffer, place in given primitive array.
|
static java.lang.Object |
readData(ucar.unidata.io.PositioningDataInputStream raf,
Layout index,
DataType dataType,
java.lang.Object arr)
Read data subset from PositioningDataInputStream, place in given primitive array.
|
static java.lang.Object |
readData(RandomAccessFile raf,
Layout layout,
DataType dataType,
java.lang.Object arr,
int byteOrder,
boolean convertChar)
Read data subset from RandomAccessFile, place in given primitive array.
|
static java.lang.Object |
readDataFill(LayoutBB layout,
DataType dataType,
java.lang.Object fillValue)
Read data subset from ByteBuffer, create primitive array of size Layout.getTotalNelems.
|
static java.lang.Object |
readDataFill(ucar.unidata.io.PositioningDataInputStream is,
Layout index,
DataType dataType,
java.lang.Object fillValue)
Read data subset from PositioningDataInputStream, create primitive array of size Layout.getTotalNelems.
|
static java.lang.Object |
readDataFill(RandomAccessFile raf,
Layout index,
DataType dataType,
java.lang.Object fillValue,
int byteOrder)
Read data subset from RandomAccessFile, create primitive array of size Layout.getTotalNelems.
|
static java.lang.Object |
readDataFill(RandomAccessFile raf,
Layout index,
DataType dataType,
java.lang.Object fillValue,
int byteOrder,
boolean convertChar) |
static Array |
readSection(ParsedSectionSpec cer) |
static long |
transferData(Array result,
java.nio.channels.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, java.nio.channels.WritableByteChannel channel) throws java.io.IOException
data
- copy from herechannel
- copy to herejava.io.IOException
- on write errorpublic static long copyToOutputStream(Array data, java.io.OutputStream out) throws java.io.IOException
data
- copy from hereout
- copy to herejava.io.IOException
- on write errorpublic static java.lang.Object makePrimitiveArray(int size, DataType dataType)
size
- the size of the array to createdataType
- dataType of the variablepublic static java.lang.Object makePrimitiveArray(int size, DataType dataType, java.lang.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 java.lang.Object readData(LayoutBB layout, DataType dataType, java.lang.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 java.lang.Object readData(ucar.unidata.io.PositioningDataInputStream raf, Layout index, DataType dataType, java.lang.Object arr) throws java.io.IOException
raf
- read from here.index
- handles skipping around in the file.dataType
- dataType of the variablearr
- primitive array to read data intojava.io.IOException
- on read errorpublic static java.lang.Object readData(RandomAccessFile raf, Layout layout, DataType dataType, java.lang.Object arr, int byteOrder, boolean convertChar) throws java.io.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 CHARjava.io.IOException
- on read errorpublic static java.lang.Object readDataFill(LayoutBB layout, DataType dataType, java.lang.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 java.lang.Object readDataFill(ucar.unidata.io.PositioningDataInputStream is, Layout index, DataType dataType, java.lang.Object fillValue) throws java.io.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
nonejava.io.IOException
- on read errorpublic static java.lang.Object readDataFill(RandomAccessFile raf, Layout index, DataType dataType, java.lang.Object fillValue, int byteOrder) throws java.io.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 readingjava.io.IOException
- on read errorpublic static java.lang.Object readDataFill(RandomAccessFile raf, Layout index, DataType dataType, java.lang.Object fillValue, int byteOrder, boolean convertChar) throws java.io.IOException
java.io.IOException
public static Array readSection(ParsedSectionSpec cer) throws java.io.IOException, InvalidRangeException
java.io.IOException
InvalidRangeException
public static long transferData(Array result, java.nio.channels.WritableByteChannel channel) throws java.io.IOException
java.io.IOException