File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,49 +226,3 @@ try (VortexReader vf = VortexReader.open(Path.of("future.vortex"), registry);
226226 }
227227}
228228` ` `
229-
230- ---
231-
232- # # Add a custom encoding
233-
234- Three touch-points required:
235-
236- ** 1. Register the encoding ID** in ` EncodingId.java` :
237-
238- ` ` ` java
239- MY_ENCODING(" com.example.my_encoding" ),
240- ` ` `
241-
242- ** 2. Implement ` Encoding` :**
243-
244- ` ` ` java
245- public final class MyEncoding implements Encoding {
246-
247- @Override
248- public EncodingId id () { return EncodingId.MY_ENCODING; }
249-
250- @Override
251- public EncodeResult encode(DType dtype, Object data) { return Encoder.encode(dtype, data); }
252-
253- @Override
254- public Array decode(DecodeContext ctx) { return Decoder.decode(ctx); }
255-
256- private static final class Encoder { /* ... * / }
257- private static final class Decoder { /* ... * / }
258- }
259- ` ` `
260-
261- ** 3. Register via ` ServiceLoader` ** — add the fully-qualified class name to:
262-
263- ` ` `
264- META-INF/services/io.github.dfa1.vortex.encoding.Encoding
265- ` ` `
266-
267- The encoding is then picked up automatically by ` EncodingRegistry.loadAll()` .
268- To register it only for a specific reader without touching the global registry:
269-
270- ` ` ` java
271- EncodingRegistry registry = EncodingRegistry.loadAll ();
272- registry.register(new MyEncoding ());
273- VortexReader vf = VortexReader.open(path, registry);
274- ` ` `
You can’t perform that action at this time.
0 commit comments