-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathCodecRegistry.java
More file actions
32 lines (25 loc) · 928 Bytes
/
CodecRegistry.java
File metadata and controls
32 lines (25 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package dev.zarr.zarrjava.v2.codec;
import com.fasterxml.jackson.databind.jsontype.NamedType;
import dev.zarr.zarrjava.v2.codec.core.BloscCodec;
import dev.zarr.zarrjava.v2.codec.core.ZlibCodec;
import dev.zarr.zarrjava.v2.codec.core.ZstdCodec;
import java.util.HashMap;
import java.util.Map;
public class CodecRegistry {
static Map<String, Class<? extends Codec>> map = new HashMap<>();
static {
addType("blosc", BloscCodec.class);
addType("zlib", ZlibCodec.class);
addType("zstd", ZstdCodec.class);
}
public static void addType(String name, Class<? extends Codec> codecClass) {
map.put(name, codecClass);
}
public static NamedType[] getNamedTypes() {
return map.entrySet()
.stream()
.map(entry -> new NamedType(entry.getValue(), entry.getKey()))
.toArray(
NamedType[]::new);
}
}