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

bt.data.range.Range Maven / Gradle / Ivy

There is a newer version: 1.10
Show newest version
package bt.data.range;

/**
 * Represents a range of binary data.
 *
 * @since 1.3
 */
public interface Range> {

    /**
     * @return Length of this data range
     *
     * @since 1.3
     */
    long length();

    /**
     * Build a subrange of this data range.
     *
     * @param offset Offset from the beginning of the original data range in bytes, inclusive
     * @param length Length of the new data range
     * @return Subrange of the original data range
     *
     * @since 1.3
     */
    Range getSubrange(long offset, long length);

    /**
     * Build a subrange of this data range.
     *
     * @param offset Offset from the beginning of the original data range in bytes, inclusive
     * @return Subrange of the original data range
     *
     * @since 1.3
     */
    Range getSubrange(long offset);

    /**
     * Get all data in this range
     *
     * @return Data in this range
     *
     * @since 1.3
     */
    byte[] getBytes();

    /**
     * Put data at the beginning of this range.
     *
     * @param block Block of data with length less than or equal to {@link #length()} of this range
     * @throws IllegalArgumentException if data does not fit in this range
     *
     * @since 1.3
     */
    void putBytes(byte[] block);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy