com.bytezone.dm3270.orders.SetAttributeOrder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dm3270-lib Show documentation
Show all versions of dm3270-lib Show documentation
This is a trimmed down version of https://github.com/dmolony/dm3270 to be used as
TN3270 client library
package com.bytezone.dm3270.orders;
import com.bytezone.dm3270.attributes.Attribute;
import com.bytezone.dm3270.display.DisplayScreen;
import com.bytezone.dm3270.display.Pen;
import java.util.Optional;
public class SetAttributeOrder extends Order {
private final Attribute attribute;
public SetAttributeOrder(byte[] buffer, int offset) {
assert buffer[offset] == Order.SET_ATTRIBUTE;
Optional opt =
Attribute.getAttribute(buffer[offset + 1], buffer[offset + 2]);
assert opt.isPresent();
attribute = opt.get();
this.buffer = new byte[3];
System.arraycopy(buffer, offset, this.buffer, 0, this.buffer.length);
}
public Attribute getAttribute() {
return attribute;
}
@Override
public void process(DisplayScreen screen) {
Pen pen = screen.getPen();
pen.addAttribute(attribute);
}
@Override
public String toString() {
return String.format("SA : %s", attribute);
}
}