/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

const fs = require('fs');
const Stream = require("./../../../unisharp/Stream");
const FileStream = require("./../../../unisharp/FileStream");

const IDynamicDataSource = require("./IDynamicDataSource");

/**
 * Default implementation of <see cref="IDynamicDataSource"/> for files stored on disk.
 */
class DynamicDiskDataSource extends IDynamicDataSource {
    
    /**
     * Initialise a default instance of <see cref="DynamicDiskDataSource"/>.
     */
    constructor() {
        super();
    }
    
    /**
     * Get a <see cref="Stream"/> providing data for an entry.
     * @param entry The entry to provide data for.
     * @param name The file name for data if known.
     * @return Returns a stream providing data; or null if not available
     */
    getSource(entry, name) {
        let result = null;
        if (name !== null) 
            result = new FileStream(name, "r", false);
        return result;
    }
}


module.exports = DynamicDiskDataSource