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

org.jace.parser.constant.StringConstantReader Maven / Gradle / Ivy

package org.jace.parser.constant;

import org.jace.parser.ConstantPool;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

public class StringConstantReader implements ConstantReader
{
	private static final short TAG = 8;

	@Override
	public int getTag()
	{
		return TAG;
	}

	@Override
	public Constant readConstant(InputStream is, ConstantPool pool) throws ClassFormatError
	{
		int index;

		try
		{
			index = new DataInputStream(is).readUnsignedShort();
		}
		catch (IOException e)
		{
			ClassFormatError exception = new ClassFormatError("Unable to read the String Constant");
			exception.initCause(e);
			throw exception;
		}

		return new StringConstant(pool, index);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy