bigdataviewer / bigdataviewer-core

ImgLib2-based viewer for registered SPIM stacks and more
BSD 2-Clause "Simplified" License
33 stars 35 forks source link

adds Closeable interface to image loaders with a close method #142

Open NicoKiaru opened 2 years ago

NicoKiaru commented 2 years ago

This PR simply adds a Closeable interface to Image Loaders which already contained a close() method.

This would allow to replace

            if ( imgLoader instanceof N5ImageLoader )
            {
                ( ( N5ImageLoader ) imgLoader ).close();
            }
            else if ( imgLoader instanceof N5OMEZarrImageLoader )
            {
                ( ( N5OMEZarrImageLoader ) imgLoader ).close();
            }
                       else if ( imgLoader instanceof Hdf5ImageLoader )
            {
                ( ( N5OMEZarrImageLoader ) imgLoader ).close();
            }

with

if ( imgLoader instanceof Closeable) {
    ( ( Closeable) imgLoader ).close();
}