类 NpyHeaderDict
- java.lang.Object
-
- org.meteoinfo.ndarray.io.npy.dict.NpyHeaderDict
-
public class NpyHeaderDict extends Object
Contains the values of the dictionary that is stored in the header of an NPY file.
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classNpyHeaderDict.Builder
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 NpyByteOrderbyteOrder()longdataSize()Returns the size of the stored array in number of bytes.NpyDataTypedataType()intdimensions()Returns the number of dimensions of the array..booleanhasFortranOrder()Returnstruewhen the array is stored in Fortran order.intnumberOfElements()Returns the number of elements that are stored in the array.static NpyHeaderDict.Builderof(NpyDataType dataType)Map<String,String>otherProperties()static NpyHeaderDictparse(String s)Stringproperty(String key)int[]shape()Returns the shape of the stored array.intsizeOfDimension(int i)Returns the size if the ith dimension of the array.byte[]toNpyHeader()StringtoString()inttypeSize()Describes the size of the stored type.
-
-
-
方法详细资料
-
of
public static NpyHeaderDict.Builder of(NpyDataType dataType)
-
dataType
public NpyDataType dataType()
-
byteOrder
public NpyByteOrder byteOrder()
-
typeSize
public int typeSize()
Describes the size of the stored type. The meaning of this field depends on the respective storage type. For numeric types it is in general the number of bytes which are required to store a single value. For strings, it is the number of characters of the string (note that for unicode strings 4 bytes are used to store a single character in NPY and that ASCII strings are stored with an additional null-termination byte).- 返回:
- the size of the stored type.
-
hasFortranOrder
public boolean hasFortranOrder()
Returnstruewhen the array is stored in Fortran order.
-
dimensions
public int dimensions()
Returns the number of dimensions of the array..
-
sizeOfDimension
public int sizeOfDimension(int i)
Returns the size if the ith dimension of the array.- 参数:
i- the 0-based dimension for which the size is requested.- 返回:
- the size of the requested dimension
- 抛出:
IndexOutOfBoundsException- ifi < 0 || i >= dimensions()
-
dataSize
public long dataSize()
Returns the size of the stored array in number of bytes. That is the number of elements of the stored array times the size of the data type in bytes.- 返回:
- the size of the stored array in bytes
-
numberOfElements
public int numberOfElements()
Returns the number of elements that are stored in the array.- 返回:
- the number of elements which is the product of all dimension sizes.
-
shape
public int[] shape()
Returns the shape of the stored array. Note that this returns a new allocated array each time you call this method.- 返回:
- the shape of the stored array
-
parse
public static NpyHeaderDict parse(String s) throws NpyFormatException
-
toNpyHeader
public byte[] toNpyHeader()
-
-