All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bytezone.dm3270.structuredfields.Outbound3270DS Maven / Gradle / Ivy

Go to download

This is a trimmed down version of https://github.com/dmolony/dm3270 to be used as TN3270 client library

There is a newer version: 0.15-lib
Show newest version
package com.bytezone.dm3270.structuredfields;

import com.bytezone.dm3270.Charset;
import com.bytezone.dm3270.commands.Command;
import com.bytezone.dm3270.display.Screen;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Outbound3270DS extends StructuredField {

  private static final Logger LOG = LoggerFactory.getLogger(Outbound3270DS.class);

  private final byte partitionID;
  private final Command command;

  // wrapper for original write commands - W. EW, EWA, EAU
  public Outbound3270DS(byte[] buffer, int offset, int length, Charset charset) {
    super(buffer, offset, length, charset);             // copies buffer -> data

    assert data[0] == StructuredField.OUTBOUND_3270DS;
    partitionID = data[1];
    assert (partitionID & (byte) 0x80) == 0;    // must be 0x00 - 0x7F

    // can only be W/EW/EWA/EAU (i.e. one of the write commands)
    command = Command.getCommand(buffer, offset + 2, length - 2, charset);
  }

  @Override
  public void process(Screen screen) {
    command.process(screen);
    if (command.getReply().isPresent()) {
      LOG.debug("Non-null reply: {}, {}", command,
          command.getReply().get()); // reply should always be null
    }
  }

  @Override
  public String toString() {
    return String.format("Struct Field : %02X Outbound3270DS\n", type)
        + String.format("   partition : %02X%n", partitionID)
        + command;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy