package org.etsi.its.codec.adapter;

import java.io.ByteArrayOutputStream;

import org.etsi.its.codec.IEnumConverter;
import org.etsi.its.codec.adapter.IType;

/**
 * This class implements a TLV element
 */
public class TLV implements IType {

	/**
	 * The type identifier
	 */
	private IEnumConverter _typeId;

	/**
	 * The value of this type
	 */
	private ByteArrayOutputStream _value;

	/**
	 * Constructor
	 * @param typeId
	 * @param value
	 */
	public TLV(IEnumConverter typeId, ByteArrayOutputStream value) {
		_typeId = typeId;
		_value = value;
	}

	/**
	 * This method provides the type identifier of the TVL element
	 * @return The type identifier of the TVL element
	 */
	public IEnumConverter getTypeId() {
		return _typeId;
	}

	/**
	 * This methods provides the value of the TVL element
	 * @return The value of the TLV element
	 */
	@Override
	public Object getValue() {
		return _value.toByteArray();
	}

} // End of class TLV
