<commit_before>package net.fusejna.examples;

import java.nio.ByteBuffer;

import net.fusejna.DirectoryFiller;
import net.fusejna.StructFuseFileInfo.FileInfoWrapper;
import net.fusejna.StructStat.NodeType;
import net.fusejna.StructStat.StatWrapper;
import net.fusejna.util.FuseFilesystemAdapterFull;

public class HelloFS extends FuseFilesystemAdapterFull
{
	public static void main(final String... args)
	{
		if (args.length != 1) {
			System.err.println("Usage: NullFS <mountpoint>");
			System.exit(1);
		}
		try {
			new HelloFS().log(true).mount(args[0]);
		}
		catch (final Throwable e) {
			System.err.println(e);
		}
	}

	private final String filename = "/hello";
	private final String contents = "Hello World!";

	@Override
	public int getattr(final String path, final StatWrapper stat)
	{
		if (path.equals(filename)) {
			stat.setMode(NodeType.FILE).size(contents.length());
		}
		return 0;
	}

	@Override
	public int read(final String path, final ByteBuffer buffer, final long size, final long offset, final FileInfoWrapper info)
	{
		final String s = contents.substring((int) offset, (int) Math.max(contents.length() - offset, offset));
		buffer.put(s.getBytes());
		return s.getBytes().length;
	}

	@Override
	public int readdir(final String path, final DirectoryFiller filler)
	{
		filler.add("hello");
		return 0;
	}
}
<commit_msg>Fix little error in HelloFS substring computation<commit_after>package net.fusejna.examples;

import java.nio.ByteBuffer;

import net.fusejna.DirectoryFiller;
import net.fusejna.StructFuseFileInfo.FileInfoWrapper;
import net.fusejna.StructStat.NodeType;
import net.fusejna.StructStat.StatWrapper;
import net.fusejna.util.FuseFilesystemAdapterFull;

public class HelloFS extends FuseFilesystemAdapterFull
{
	public static void main(final String... args)
	{
		if (args.length != 1) {
			System.err.println("Usage: NullFS <mountpoint>");
			System.exit(1);
		}
		try {
			new HelloFS().log(true).mount(args[0]);
		}
		catch (final Throwable e) {
			System.err.println(e);
		}
	}

	private final String filename = "/hello";
	private final String contents = "Hello World!";

	@Override
	public int getattr(final String path, final StatWrapper stat)
	{
		if (path.equals(filename)) {
			stat.setMode(NodeType.FILE).size(contents.length());
		}
		return 0;
	}

	@Override
	public int read(final String path, final ByteBuffer buffer, final long size, final long offset, final FileInfoWrapper info)
	{
		// Compute substring that we are being asked to read
		final String s = contents.substring((int) offset,
				(int) Math.max(offset, Math.min(contents.length() - offset, offset + size)));
		buffer.put(s.getBytes());
		return s.getBytes().length;
	}

	@Override
	public int readdir(final String path, final DirectoryFiller filler)
	{
		filler.add("hello");
		return 0;
	}
}

{'fraction_non_alphanumeric': 0.12117981520966596, 'fraction_numerical': 0.0035536602700781805, 'mean_word_length': 4.5088062622309195, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5699283', 'n_tokens_mistral': 999, 'n_tokens_neox': 923, 'n_words': 231}