类 Npy


  • public class Npy
    extends Object
    • 构造器详细资料

      • Npy

        public Npy()
    • 方法详细资料

      • 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 unsupported
        RuntimeException - 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 unsupported
        RuntimeException - 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 unsupported
        RuntimeException - 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 file
        fn - 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 path
        array - The data array
      • save

        public static void save​(File file,
                                Array array)
        Save array data to a npy file
        参数:
        file - The file
        array - The data array
      • save

        public static void save​(WritableByteChannel channel,
                                Array array)
        Save array data to a npy file
        参数:
        channel - The file channel
        array - The data array