/** returns a list of all available codec names */ public static Set<String> availableCodecs() { if (loader == null) { throw new IllegalStateException( "You called Codec.availableCodecs() before all Codecs could be initialized. " + "This likely happens if you call it from a Codec's ctor."); } return loader.availableServices(); }
/** looks up a codec by name */ public static Codec forName(String name) { if (loader == null) { throw new IllegalStateException( "You called Codec.forName() before all Codecs could be initialized. " + "This likely happens if you call it from a Codec's ctor."); } return loader.lookup(name); }
/** returns a list of all available codec names */ public static Set<String> availableCodecs() { return loader.availableServices(); }
/** looks up a codec by name */ public static Codec forName(String name) { return loader.lookup(name); }
public Codec(String name) { NamedSPILoader.checkServiceName(name); this.name = name; }
/** * Reloads the codec list from the given {@link ClassLoader}. Changes to the codecs are visible * after the method ends, all iterators ({@link #availableCodecs()},...) stay consistent. * * <p><b>NOTE:</b> Only new codecs are added, existing ones are never removed or replaced. * * <p><em>This method is expensive and should only be called for discovery of new codecs on the * given classpath/classloader!</em> */ public static void reloadCodecs(ClassLoader classloader) { loader.reload(classloader); }