package net.northking.cctp.upperComputer.driver.ios.command.data;


import net.northking.cctp.upperComputer.driver.ios.packet.ICommandData;

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

public class ScreenShotData implements ICommandData {
    public int dataLength;

    public byte[] data;

    @Override
    public void buildFromInput(DataInput dataInput) throws IOException {
        dataLength = dataInput.readInt();
        if (dataLength > 0) {
            data = new byte[dataLength];
            dataInput.readFully(data);
        }
    }

    @Override
    public void encodeToOutput(DataOutput dataOutput) throws IOException {
        if (dataLength > 0) {
            dataOutput.writeInt(dataLength);
            dataOutput.write(data);
        }
    }
}
