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

com.softicar.platform.common.io.classfile.constants.ClassFileConstantUtf8 Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.io.classfile.constants;

import com.softicar.platform.common.io.classfile.ClassFileReader;
import com.softicar.platform.common.io.classfile.constant.ClassFileConstantType;
import com.softicar.platform.common.string.unicode.Utf8Convering;

public class ClassFileConstantUtf8 extends ClassFileConstant {

	private final int length;
	private final byte[] bytes;
	private String text;

	public ClassFileConstantUtf8(ClassFileReader reader) {

		super(ClassFileConstantType.UTF8);

		this.length = reader.readInt16();
		this.bytes = reader.readBytes(length);
		this.text = null;
	}

	public int getLength() {

		return length;
	}

	public byte[] getBytes() {

		return bytes;
	}

	public String getText() {

		if (text == null) {
			this.text = Utf8Convering.fromUtf8(bytes);
		}
		return text;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy