@Override
	public synchronized int read(byte[] data) throws SevenZipException {
		try {
			int bytesToRead = (int)Math.min(data.length, bp.length() - position);
			if (bytesToRead <= 0) {
				return 0;
			}
			byte[] bytes = bp.readBytes(position, bytesToRead);
			System.arraycopy(bytes, 0, data, 0, bytes.length);

			position += bytes.length;
			return bytes.length;
		}
		catch (IOException e) {
			throw new SevenZipException("Error reading random access file", e);
		}
	}
Adapter from Ghidra's {@link ByteProvider} to SZ's {@link IInStream}
Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/sevenzip/SZByteProviderStream.java