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

webit.script.core.text.impl.SimpleTextStatement Maven / Gradle / Ivy

The newest version!
// Copyright (c) 2013-2014, Webit Team. All Rights Reserved.
package webit.script.core.text.impl;

import webit.script.Context;
import webit.script.core.ast.Statement;

/**
 *
 * @author Zqq
 */
public final class SimpleTextStatement extends Statement {

    private final String encoding;
    private final char[] text;
    private final byte[] textBytes;

    public SimpleTextStatement(char[] chars, byte[] bytes, String encoding, int line, int column) {
        super(line, column);
        this.text = chars;
        this.encoding = encoding;
        this.textBytes = bytes;
    }

    public Object execute(final Context context) {
        if (context.isByteStream && encoding == context.encoding) {
            context.outNotNull(textBytes);
        } else {
            context.outNotNull(text);
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy