<commit_before>using System;
using System.IO;
using System.Text;

namespace DbfDataReader
{
    public abstract class DbfMemo : Disposable
    {
        protected const int BlockHeaderSize = 8;
        protected const int DefaultBlockSize = 512;

        protected BinaryReader _binaryReader;

        protected DbfMemo(string path)
            : this(path, EncodingProvider.GetEncoding(1252))
        {
        }

        protected DbfMemo(string path, Encoding encoding)
        {
            if (!File.Exists(path))
            {
                throw new FileNotFoundException();
            }

            Path = path;
            CurrentEncoding = encoding;

            var stream = new FileStream(path, FileMode.Open);
            _binaryReader = new BinaryReader(stream, encoding);
        }

        protected DbfMemo(Stream stream, Encoding encoding)
        {
            Path = string.Empty;
            CurrentEncoding = encoding;

            _binaryReader = new BinaryReader(stream, encoding);
        }

        public Encoding CurrentEncoding { get; set; }

        public void Close()
        {
            Dispose(true);
        }

        protected override void Dispose(bool disposing)<commit_msg>Makes memo stream close behaviour the same as for tables<commit_after>using System;
using System.IO;
using System.Text;

namespace DbfDataReader
{
    public abstract class DbfMemo : Disposable
    {
        protected const int BlockHeaderSize = 8;
        protected const int DefaultBlockSize = 512;

        protected BinaryReader _binaryReader;

        protected DbfMemo(string path)
            : this(path, EncodingProvider.GetEncoding(1252))
        {
        }

        protected DbfMemo(string path, Encoding encoding)
        {
            if (!File.Exists(path))
            {
                throw new FileNotFoundException();
            }

            Path = path;
            CurrentEncoding = encoding;

            var stream = new FileStream(path, FileMode.Open);
            _binaryReader = new BinaryReader(stream, encoding, false);
        }

        protected DbfMemo(Stream stream, Encoding encoding)
        {
            Path = string.Empty;
            CurrentEncoding = encoding;

            _binaryReader = new BinaryReader(stream, encoding, true);
        }

        public Encoding CurrentEncoding { get; set; }

        public void Close()
        {
            Dispose(true);
        }

        protected override void Dispose(bool disposing)
{'fraction_non_alphanumeric': 0.06976744186046512, 'fraction_numerical': 0.006415396952686447, 'mean_word_length': 1.8877314814814814, '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': '6618590', 'n_tokens_mistral': 645, 'n_tokens_neox': 600, 'n_words': 172}