@Override
	public int read(byte[] b, int off, int len) throws IOException {
		if (!ensureChunkAvailable()) {
			return -1;
		}

		int bytesAvail = currentChunk.length - chunkPos;
		int bytesToCopy = Math.min(len, bytesAvail);
		System.arraycopy(currentChunk, chunkPos, b, off, bytesToCopy);
		chunkPos += bytesToCopy;
		return bytesToCopy;
	}
Implements an InputStream compatible read(buffer, offset, length)

@param b The buffer in which to read the bytes
@param off Offset within the output offer to copy
@param len Length of bytes to read into the output buffer
@return The number of bytes copied to the output buffer
@throws IOException If there is a read failure of the data
Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/cart/CartV1StreamProcessor.java