/*
 * 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
 */

package com.pullenti.unitext.internal.zip;

// Represents a string from a <see cref="ZipFile"/> which is stored as an array of bytes.
public class ZipString {

    public ZipString(String comment) {
        comment_ = comment;
        isSourceString_ = true;
    }

    public boolean isSourceString() {
        return isSourceString_;
    }


    public int getRawLength() {
        this.makeBytesAvailable();
        return rawComment_.length;
    }


    public byte[] getRawComment() {
        this.makeBytesAvailable();
        return rawComment_;
    }


    public void reset() {
        if (isSourceString_) 
            rawComment_ = null;
        else 
            comment_ = null;
    }

    private void makeTextAvailable() {
        if (comment_ == null) 
            comment_ = ZipConstants.convertToString0(rawComment_);
    }

    private void makeBytesAvailable() {
        if (rawComment_ == null) 
            rawComment_ = ZipConstants.convertToArrayStr(comment_);
    }

    public static String ooString(ZipString zipString) {
        zipString.makeTextAvailable();
        return zipString.comment_;
    }

    private String comment_;

    private byte[] rawComment_;

    private boolean isSourceString_;
    public ZipString() {
    }
}
