public static InputStream getSubInputStream(BinaryReader reader, long length) {

		// Get the start of the stream and advance the reader position
		long start = reader.getPointerIndex();
		reader.setPointerIndex(start + length);

		// Create and the input stream
		ByteProvider bp = reader.getByteProvider();
		ByteProviderWrapper subBP = new ByteProviderWrapper(bp, start, length);
		return new ByteProviderInputStream.ClosingInputStream(subBP);
	}
Create an InputStream containing only the next n bytes from the given reader
@param reader A BinaryReader pointed at the start of the bytes to be read
@param length The amount of bytes to be read
@return An InputStream containing n bytes
Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/squashfs/SquashUtils.java