All Downloads are FREE. Search and download functionalities are using the official Maven repository.

htsjdk.samtools.IndexFileBufferFactory Maven / Gradle / Ivy

There is a newer version: 4.1.3
Show newest version
package htsjdk.samtools;

import htsjdk.samtools.util.IOUtil;
import htsjdk.samtools.util.RuntimeIOException;

import java.io.File;
import java.io.IOException;

class IndexFileBufferFactory {

    static IndexFileBuffer getBuffer(File file, boolean enableMemoryMapping) {
        boolean isCompressed;
        try {
            isCompressed = IOUtil.isBlockCompressed(file.toPath());
        } catch (IOException ioe) {
            throw (new RuntimeIOException(ioe));
        }

        return isCompressed ? new CompressedIndexFileBuffer(file) : (enableMemoryMapping ? new MemoryMappedFileBuffer(file) : new RandomAccessFileBuffer(file));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy