<commit_before>package com.kbolino.libraries.bytestring;

import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.ReadOnlyBufferException;

/**
 * An immutable string of bytes.
 * Analogous to {@link String} but for {@code byte}s instead of {@code char}s.
 * @see ByteStrings
 */
public interface ByteString {
	/**
	 * Returns the length of this string.
	 * @return  The number of bytes in this {@link ByteString}.
	 */
	public int length();
	
	/**
	 * Is this string empty?
	 * @return  True if and only if <code>{@link #length()} == 0</code>.
	 */
	public boolean isEmpty();

	/**
	 * Returns the value at the given index.
	 * @param index  The index of the byte to retrieve.
	 * @return  The value of the byte at {@code index}.
	 * @throws IllegalArgumentException  If {@code index < 0}.
	 * @throws IndexOutOfBoundsException  If 
	 *   <code>index &gt;= {@link #length()}</code>
	 */
	public byte at(int index) throws IllegalArgumentException, IndexOutOfBoundsException;
	
	/**
	 * Returns the unsigned value at the given index.
	 * @param index  The index of the byte to retrieve.<commit_msg>Improve javadoc for at/unsignedAt in ByteString for consistency<commit_after>package com.kbolino.libraries.bytestring;

import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.ReadOnlyBufferException;

/**
 * An immutable string of bytes.
 * Analogous to {@link String} but for {@code byte}s instead of {@code char}s.
 * @see ByteStrings
 */
public interface ByteString {
	/**
	 * Returns the length of this string.
	 * @return  The number of bytes in this {@link ByteString}.
	 */
	public int length();
	
	/**
	 * Is this string empty?
	 * @return  True if and only if <code>{@link #length()} == 0</code>.
	 */
	public boolean isEmpty();

	/**
	 * Returns the value of a byte.
	 * @param index  The index of the byte to retrieve.
	 * @return  The value of the byte at {@code index}.
	 * @throws IllegalArgumentException  If {@code index < 0}.
	 * @throws IndexOutOfBoundsException  If 
	 *   <code>index &gt;= {@link #length()}</code>
	 */
	public byte at(int index) throws IllegalArgumentException, IndexOutOfBoundsException;
	
	/**
	 * Returns the unsigned value of a byte.
	 * @param index  The index of the byte to retrieve.
{'fraction_non_alphanumeric': 0.11514886164623468, 'fraction_numerical': 0.0017513134851138354, 'mean_word_length': 3.67280163599182, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1920408', 'n_tokens_mistral': 690, 'n_tokens_neox': 644, 'n_words': 256}