/*
 * 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 ZipConstants = require("./ZipConstants");

// Represents a string from a <see cref="ZipFile"/> which is stored as an array of bytes.
class ZipString {
    
    constructor(comment) {
        this.comment_ = null;
        this.rawComment_ = null;
        this.isSourceString_ = false;
        this.comment_ = comment;
        this.isSourceString_ = true;
    }
    
    get isSourceString() {
        return this.isSourceString_;
    }
    
    get rawLength() {
        this.makeBytesAvailable();
        return this.rawComment_.length;
    }
    
    get rawComment() {
        this.makeBytesAvailable();
        return this.rawComment_;
    }
    
    reset() {
        if (this.isSourceString_) 
            this.rawComment_ = null;
        else 
            this.comment_ = null;
    }
    
    makeTextAvailable() {
        if (this.comment_ === null) 
            this.comment_ = ZipConstants.convertToString0(this.rawComment_);
    }
    
    makeBytesAvailable() {
        if (this.rawComment_ === null) 
            this.rawComment_ = ZipConstants.convertToArrayStr(this.comment_);
    }
    
    static ooString(zipString) {
        zipString.makeTextAvailable();
        return zipString.comment_;
    }
}


module.exports = ZipString