<commit_before>﻿using System;
using System.IO;
using Microsoft.Win32.SafeHandles;

namespace BTDB.StreamLayer
{
    public class PositionLessFileStreamProxy : IPositionLessStream
    {
        readonly FileStream _stream;
        readonly SafeFileHandle _handle;
        readonly bool _dispose;

        public PositionLessFileStreamProxy(string fileName)
        {
            if (string.IsNullOrEmpty(fileName)) throw new ArgumentOutOfRangeException(nameof(fileName));
            _stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 1, FileOptions.None);
            _handle = _stream.SafeFileHandle;
            _dispose = true;
        }

        public PositionLessFileStreamProxy(FileStream stream, bool dispose)
        {
            if (stream == null) throw new ArgumentNullException(nameof(stream));
            _stream = stream;
            _dispose = dispose;
        }

        public int Read(byte[] data, int offset, int size, ulong pos)
        {<commit_msg>Missing line in new class ...<commit_after>﻿using System;
using System.IO;
using Microsoft.Win32.SafeHandles;

namespace BTDB.StreamLayer
{
    public class PositionLessFileStreamProxy : IPositionLessStream
    {
        readonly FileStream _stream;
        readonly SafeFileHandle _handle;
        readonly bool _dispose;

        public PositionLessFileStreamProxy(string fileName)
        {
            if (string.IsNullOrEmpty(fileName)) throw new ArgumentOutOfRangeException(nameof(fileName));
            _stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 1, FileOptions.None);
            _handle = _stream.SafeFileHandle;
            _dispose = true;
        }

        public PositionLessFileStreamProxy(FileStream stream, bool dispose)
        {
            if (stream == null) throw new ArgumentNullException(nameof(stream));
            _stream = stream;
            _handle = _stream.SafeFileHandle;
            _dispose = dispose;
        }

        public int Read(byte[] data, int offset, int size, ulong pos)
        {
{'fraction_non_alphanumeric': 0.07435653002859867, 'fraction_numerical': 0.002859866539561487, 'mean_word_length': 2.6760070052539406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6807636', 'n_tokens_mistral': 550, 'n_tokens_neox': 545, 'n_words': 139}