cancel.java

来自「华为java接口反编译结果!其中包含其所有接口实现过程」· Java 代码 · 共 53 行

JAVA
53
字号
package com.kelefa.cmpp;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.DataInputStream;
import com.kelefa.cmpp.result.Result;
import com.kelefa.cmpp.result.CancelResult;

public final class Cancel
{
  public static final int LEN = 8;

  protected byte[] msg_id = new byte[LEN];

  public Cancel()
  {
  }

  public void setMsg_id( String s )
      throws OutOfBoundsException
  {
    if ( s.length() > LEN )
      throw new OutOfBoundsException();

    byte[] tem = s.getBytes();
    System.arraycopy( tem, 0, msg_id, 0, tem.length );
  }

  public void execute( ConnDesc conn )
      throws IOException, OutOfBoundsException
  {
    Header header = new Header();

    header.pk_cmd = Const.CMPPE_CANCEL;
    header.pk_seq = conn.getSeq();
    header.pk_len += LEN;

    DataOutputStream out = new DataOutputStream( conn.sock.getOutputStream() );
    header.send( out );
    out.write( msg_id );
  }

  public static Result respond(DataInputStream in,Header header)
      throws IOException
  {
    CancelResult result = new CancelResult();
    result.success_Id = in.readByte();
    return result;
  }


}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?