Package dev.zarr.zarrjava.v3
Class Array
java.lang.Object
dev.zarr.zarrjava.v3.Node
dev.zarr.zarrjava.v3.Array
- All Implemented Interfaces:
Array
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.zarr.zarrjava.core.Array
Array.ArrayAccessor -
Field Summary
FieldsFields inherited from class dev.zarr.zarrjava.v3.Node
storeHandle, ZARR_JSON -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedArray(StoreHandle storeHandle, ArrayMetadata arrayMetadata) -
Method Summary
Modifier and TypeMethodDescriptionstatic Arraycreate(StoreHandle storeHandle, ArrayMetadata arrayMetadata) Creates a new Zarr array with the provided metadata at a specified storage location.static Arraycreate(StoreHandle storeHandle, ArrayMetadata arrayMetadata, boolean existsOk) Creates a new Zarr array with the provided metadata at a specified storage location.static Arraycreate(StoreHandle storeHandle, Function<ArrayMetadataBuilder, ArrayMetadataBuilder> arrayMetadataBuilderMapper, boolean existsOk) Creates a new Zarr array at a specified storage location.metadata()static ArrayMetadataBuilderstatic ArrayMetadataBuildermetadataBuilder(ArrayMetadata existingMetadata) static Arrayopen(StoreHandle storeHandle) Opens an existing Zarr array at a specified storage location.resize(long[] newShape) Sets a new shape for the Zarr array.setAttributes(Map<String, Object> newAttributes) Sets the attributes of the Zarr array.toString()Updates the attributes of the Zarr array.Methods inherited from class dev.zarr.zarrjava.v3.Node
makeObjectMapper, storeHandleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.zarr.zarrjava.core.Array
access, chunkIsInArray, read, read, read, read, readChunk, storeHandle, write, write, write, write, writeChunk
-
Field Details
-
metadata
-
-
Constructor Details
-
Array
- Throws:
ZarrException
-
-
Method Details
-
open
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 readZarrException- throws ZarrException if the Zarr array cannot be opened
-
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 arrayarrayMetadata- the metadata of the Zarr array- Throws:
IOException- if the metadata cannot be serializedZarrException- 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 arrayarrayMetadata- the metadata of the Zarr arrayexistsOk- if true, no exception is raised if the Zarr array already exists- Throws:
IOException- throws IOException if the metadata cannot be serializedZarrException- throws ZarrException if the Zarr array cannot be created
-
create
public static Array create(StoreHandle storeHandle, Function<ArrayMetadataBuilder, ArrayMetadataBuilder> arrayMetadataBuilderMapper, boolean existsOk) throws IOException, ZarrExceptionCreates 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 arrayarrayMetadataBuilderMapper- a callback that is used to construct the metadata of the Zarr arrayexistsOk- if true, no exception is raised if the Zarr array already exists- Throws:
IOException- if the metadata cannot be serializedZarrException- if the Zarr array cannot be created
-
metadataBuilder
-
metadataBuilder
-
codecPipeline
- Specified by:
codecPipelinein interfaceArray
-
metadata
-
resize
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 invalidIOException- throws IOException if the new metadata cannot be serialized
-
setAttributes
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 invalidIOException- throws IOException if the new metadata cannot be serialized
-
updateAttributes
public Array updateAttributes(Function<Map<String, Object>, throws ZarrException, IOExceptionMap<String, Object>> attributeMapper) 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 invalidIOException- throws IOException if the new metadata cannot be serialized
-
toString
-