package com.gyee.edge.protocol.iec60870.infoelement;

import java.io.DataInputStream;
import java.io.IOException;

/**
 * Represents a qualifier of interrogation (QOI) information element.
 */
public class IeQualifierOfInterrogation extends InformationElement {

    private final int value;

    public IeQualifierOfInterrogation(int value) {
        this.value = value;
    }

    IeQualifierOfInterrogation(DataInputStream is) throws IOException {
        value = (is.readByte() & 0xff);
    }

    @Override
    int encode(byte[] buffer, int i) {
        buffer[i] = (byte) value;
        return 1;
    }

    public int getValue() {
        return value;
    }

    @Override
    public String toString() {
        return "Qualifier of interrogation: " + value;
    }
}
