Class Array

All Implemented Interfaces:
Node, Node

public class Array extends Array implements Node
  • Constructor Details

  • Method Details

    • metadata

      public ArrayMetadata metadata()
      Specified by:
      metadata in class Array
    • open

      public static Array open(StoreHandle storeHandle) throws IOException, ZarrException
      Opens an existing Zarr array at a specified storage location.
      Parameters:
      storeHandle - the storage location of the Zarr array
      Throws:
      IOException - throws IOException if the metadata cannot be read
      ZarrException - throws ZarrException if the Zarr array cannot be opened
    • open

      public static Array open(Path path) throws IOException, ZarrException
      Opens an existing Zarr array at a specified storage location using a Path.
      Parameters:
      path - the storage location of the Zarr array
      Throws:
      IOException - if the metadata cannot be read
      ZarrException - if the Zarr array cannot be opened
    • open

      public static Array open(String path) throws IOException, ZarrException
      Opens an existing Zarr array at a specified storage location using a String path.
      Parameters:
      path - the storage location of the Zarr array
      Throws:
      IOException - if the metadata cannot be read
      ZarrException - if the Zarr array cannot be opened
    • create

      public static Array create(Path path, ArrayMetadata arrayMetadata) throws IOException, ZarrException
      Creates a new Zarr array with the provided metadata at a specified storage location. This method will raise an exception if a Zarr array already exists at the specified storage location.
      Parameters:
      path - the storage location of the Zarr array
      arrayMetadata - the metadata of the Zarr array
      Throws:
      IOException - if the metadata cannot be serialized
      ZarrException - if the Zarr array cannot be created
    • create

      public static Array create(String path, ArrayMetadata arrayMetadata) throws IOException, ZarrException
      Creates a new Zarr array with the provided metadata at a specified storage location. This method will raise an exception if a Zarr array already exists at the specified storage location.
      Parameters:
      path - the storage location of the Zarr array
      arrayMetadata - the metadata of the Zarr array
      Throws:
      IOException - if the metadata cannot be serialized
      ZarrException - if the Zarr array cannot be created
    • create

      public static Array create(StoreHandle storeHandle, ArrayMetadata arrayMetadata) throws IOException, ZarrException
      Creates a new Zarr array with the provided metadata at a specified storage location. This method will raise an exception if a Zarr array already exists at the specified storage location.
      Parameters:
      storeHandle - the storage location of the Zarr array
      arrayMetadata - the metadata of the Zarr array
      Throws:
      IOException - if the metadata cannot be serialized
      ZarrException - if the Zarr array cannot be created
    • create

      public static Array create(StoreHandle storeHandle, ArrayMetadata arrayMetadata, boolean existsOk) throws IOException, ZarrException
      Creates a new Zarr array with the provided metadata at a specified storage location. If `existsOk` is false, this method will raise an exception if a Zarr array already exists at the specified storage location.
      Parameters:
      storeHandle - the storage location of the Zarr array
      arrayMetadata - the metadata of the Zarr array
      existsOk - if true, no exception is raised if the Zarr array already exists
      Throws:
      IOException - throws IOException if the metadata cannot be serialized
      ZarrException - throws ZarrException if the Zarr array cannot be created
    • create

      public static Array create(StoreHandle storeHandle, Function<ArrayMetadataBuilder,ArrayMetadataBuilder> arrayMetadataBuilderMapper, boolean existsOk) throws IOException, ZarrException
      Creates a new Zarr array at a specified storage location. This method provides a callback that gets an ArrayMetadataBuilder and needs to return such an ArrayMetadataBuilder. The callback can be used to construct the metadata of the Zarr array. If `existsOk` is false, this method will raise an exception if a Zarr array already exists at the specified storage location.
      Parameters:
      storeHandle - the storage location of the Zarr array
      arrayMetadataBuilderMapper - a callback that is used to construct the metadata of the Zarr array
      existsOk - if true, no exception is raised if the Zarr array already exists
      Throws:
      IOException - if the metadata cannot be serialized
      ZarrException - if the Zarr array cannot be created
    • create

      public static Array create(Path path, Function<ArrayMetadataBuilder,ArrayMetadataBuilder> arrayMetadataBuilderMapper, boolean existsOk) throws IOException, ZarrException
      Throws:
      IOException
      ZarrException
    • create

      public static Array create(String path, Function<ArrayMetadataBuilder,ArrayMetadataBuilder> arrayMetadataBuilderMapper, boolean existsOk) throws IOException, ZarrException
      Throws:
      IOException
      ZarrException
    • metadataBuilder

      @Nonnull public static ArrayMetadataBuilder metadataBuilder()
    • metadataBuilder

      @Nonnull public static ArrayMetadataBuilder metadataBuilder(ArrayMetadata existingMetadata)
    • resize

      public Array resize(long[] newShape) throws ZarrException, IOException
      Sets a new shape for the Zarr array. It only changes the metadata, no array data is modified or deleted. This method returns a new instance of the Zarr array class and the old instance becomes invalid.
      Parameters:
      newShape - the new shape of the Zarr array
      Throws:
      ZarrException - if the new metadata is invalid
      IOException - throws IOException if the new metadata cannot be serialized
    • setAttributes

      public Array setAttributes(Map<String,Object> newAttributes) throws ZarrException, IOException
      Sets the attributes of the Zarr array. It overwrites and removes any existing attributes. This method returns a new instance of the Zarr array class and the old instance becomes invalid.
      Parameters:
      newAttributes - the new attributes of the Zarr array
      Throws:
      ZarrException - throws ZarrException if the new metadata is invalid
      IOException - throws IOException if the new metadata cannot be serialized
    • updateAttributes

      public Array updateAttributes(Function<Map<String,Object>,Map<String,Object>> attributeMapper) throws ZarrException, IOException
      Updates the attributes of the Zarr array. It provides a callback that gets the current attributes as input and needs to return the new set of attributes. The attributes in the callback may be mutated. This method overwrites and removes any existing attributes. This method returns a new instance of the Zarr array class and the old instance becomes invalid.
      Parameters:
      attributeMapper - the callback that is used to construct the new attributes
      Throws:
      ZarrException - throws ZarrException if the new metadata is invalid
      IOException - throws IOException if the new metadata cannot be serialized
    • toString

      public String toString()
      Overrides:
      toString in class Object