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

org.broadinstitute.hellbender.engine.spark.datasources.DirectFullByteArrayByteAccess Maven / Gradle / Ivy

There is a newer version: 4.6.0.0
Show newest version
package org.broadinstitute.hellbender.engine.spark.datasources;

import org.bdgenomics.utils.io.ByteArrayByteAccess;

/**
 * A version of org.bdgenomics.utils.io.ByteArrayByteAccess that makes no copies of byte array used for initialization.
 * However DirectFullByteArrayByteAccess.readFully can only return a reference to the full underlying byte array.
 * Therefore, the user should exercise caution that the underlying data does not get mutated.
 */
class DirectFullByteArrayByteAccess extends ByteArrayByteAccess {
    private static final long serialVersionUID = 1L;

    DirectFullByteArrayByteAccess(byte[] bytes) {
        super(bytes);
    }

    @Override
    public byte[] readFully(long offset, int length) {
        if ((offset != 0) || (length != this.length())) {
            throw new IllegalArgumentException("readFully can only return a reference to the full underlying byte array");
        }
        return this.bytes();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy