类 Npy
- java.lang.Object
-
- org.meteoinfo.ndarray.io.npy.Npy
-
public class Npy extends Object
-
-
构造器概要
构造器 构造器 说明 Npy()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static Arrayload(File file)Load the content of the given file into NPY array instance.static Arrayload(String fileName)Load the content of the given file into NPY array instance.static Arrayload(ReadableByteChannel channel)Load the content of the given file into NPY array instance.static voidsave(File file, Array array)Save array data to a npy filestatic voidsave(OutputStream outputStream, Array array)static voidsave(String fileName, Array array)Save array data to a npy filestatic voidsave(WritableByteChannel channel, Array array)Save array data to a npy filestatic voiduse(File file, BiConsumer<RandomAccessFile,NpyHeader> fn)Opens the given file as a random access file and reads the NPY header.static voidwrite(File file, NpyHeaderDict dict, byte[] data)
-
-
-
方法详细资料
-
load
public static Array load(String fileName)
Load the content of the given file into NPY array instance.- 参数:
file- the NPY file to read- 返回:
- the mapped NPY array
- 抛出:
NpyFormatException- if the NPY format is invalid or unsupportedRuntimeException- IO exceptions are wrapped in runtime exceptions
-
load
public static Array load(File file)
Load the content of the given file into NPY array instance.- 参数:
file- the NPY file to read- 返回:
- the mapped NPY array
- 抛出:
NpyFormatException- if the NPY format is invalid or unsupportedRuntimeException- IO exceptions are wrapped in runtime exceptions
-
load
public static Array load(ReadableByteChannel channel)
Load the content of the given file into NPY array instance.- 参数:
channel- the NPY file to read- 返回:
- the mapped NPY array
- 抛出:
NpyFormatException- if the NPY format is invalid or unsupportedRuntimeException- IO exceptions are wrapped in runtime exceptions
-
use
public static void use(File file, BiConsumer<RandomAccessFile,NpyHeader> fn)
Opens the given file as a random access file and reads the NPY header. It calls the given consumer with the opened file and header and closes the file when the consumer returns. This is useful when you want to do multiple operations on an NPY file, e.g. read multiple columns.- 参数:
file- the NPY filefn- a consumer of the opened random access file and NPY header
-
save
public static void save(String fileName, Array array)
Save array data to a npy file- 参数:
fileName- The file patharray- The data array
-
save
public static void save(File file, Array array)
Save array data to a npy file- 参数:
file- The filearray- The data array
-
save
public static void save(WritableByteChannel channel, Array array)
Save array data to a npy file- 参数:
channel- The file channelarray- The data array
-
save
public static void save(OutputStream outputStream, Array array)
-
write
public static void write(File file, NpyHeaderDict dict, byte[] data)
-
-