/*
 * 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.pdf;

public class PdfName extends PdfObject {

    public String name;

    @Override
    public String toStringEx(int lev) {
        return name;
    }

    @Override
    public boolean isSimple(int lev) {
        return true;
    }

    @Override
    public void write(com.pullenti.unisharp.Stream s) {
        try {
            s.write((byte)'/');
            for (char ch : name.toCharArray()) {
                if ("%()<>[]{}/#".indexOf(ch) >= 0 || ((int)ch) <= 0x20) {
                    String hex = String.format("%02X", (int)ch);
                    s.write((byte)'#');
                    s.write((byte)hex.charAt(0));
                    s.write((byte)hex.charAt(1));
                }
                else 
                    s.write((byte)ch);
            }
        } catch (Exception ex123) {
        }
    }

    public static PdfName _new229(String _arg1) {
        PdfName res = new PdfName();
        res.name = _arg1;
        return res;
    }
    public PdfName() {
        super();
    }
}
