package net.northking.cctp.upperComputer.driver.ios.packet;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class BooleanCommandData implements ICommandData {
    boolean success = false;

    public BooleanCommandData() {
    }

    public BooleanCommandData(boolean success) {
        this.success = success;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    @Override
    public void buildFromInput(DataInput dataInput) throws IOException {
        success = dataInput.readBoolean();
    }

    @Override
    public void encodeToOutput(DataOutput dataOutput) throws IOException {
        dataOutput.writeBoolean(success);
    }

    @Override
    public String toString() {
        return success ? "true" : "false";
    }

}
