All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ergoplatform.appkit.BoxAttachmentPlainText Maven / Gradle / Ivy

The newest version!
package org.ergoplatform.appkit;

import java.nio.charset.StandardCharsets;

/**
 * EIP-29 attachment containing a simple text
 */
public class BoxAttachmentPlainText extends BoxAttachmentGeneric {
    private final String text;

    public BoxAttachmentPlainText(byte[] attachmentContent) {
        super(Type.PLAIN_TEXT.toTypeRawValue(), attachmentContent);

        text = new String(attachmentContent, StandardCharsets.UTF_8);
    }

    /**
     * @return text, attachment content
     */
    public String getText() {
        return text;
    }

    public static BoxAttachmentPlainText buildForText(String text) {
        return new BoxAttachmentPlainText(text.getBytes(StandardCharsets.UTF_8));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy