org.apache.sshd.common.util.buffer.Buffer.getInt()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中org.apache.sshd.common.util.buffer.Buffer.getInt()方法的一些代码示例,展示了Buffer.getInt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.getInt()方法的具体详情如下:
包路径:org.apache.sshd.common.util.buffer.Buffer
类名称:Buffer
方法名:getInt

Buffer.getInt介绍

暂无

代码示例

代码示例来源:origin: org.apache.sshd/sshd-sftp

public Supported parse(Buffer buffer) {
    Supported sup = new Supported();
    sup.supportedAttributeMask = buffer.getInt();
    sup.supportedAttributeBits = buffer.getInt();
    sup.supportedOpenFlags = buffer.getInt();
    sup.supportedAccessMask = buffer.getInt();
    sup.maxReadSize = buffer.getInt();
    sup.extensionNames = buffer.getStringList(false);
    return sup;
  }
}

代码示例来源:origin: org.apache.sshd/sshd-core

/**
 * Retrieve the channel designated by the given packet
 *
 * @param cmd The command being processed for the channel
 * @param buffer the incoming packet
 * @return the target channel
 * @throws IOException if the channel does not exists
 */
protected Channel getChannel(byte cmd, Buffer buffer) throws IOException {
  return getChannel(cmd, buffer.getInt(), buffer);
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

/**
 * Retrieve the channel designated by the given packet
 *
 * @param cmd The command being processed for the channel
 * @param buffer the incoming packet
 * @return the target channel
 * @throws IOException if the channel does not exists
 */
protected Channel getChannel(byte cmd, Buffer buffer) throws IOException {
  return getChannel(cmd, buffer.getInt(), buffer);
}

代码示例来源:origin: org.apache.sshd/sshd-sftp

public AclCapabilities parse(Buffer buffer) {
    return new AclCapabilities(buffer.getInt());
  }
}

代码示例来源:origin: org.apache.sshd/sshd-core

@Override
protected Integer processRequestValue(Channel channel, String request, Buffer buffer) throws Exception {
  return processRequestValue(channel, buffer.getInt());
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

@Override
protected Integer processRequestValue(Channel channel, String request, Buffer buffer) throws Exception {
  return processRequestValue(channel, buffer.getInt());
}

代码示例来源:origin: org.apache.sshd/sshd-sftp

public Supported2 parse(Buffer buffer) {
    Supported2 sup2 = new Supported2();
    sup2.supportedAttributeMask = buffer.getInt();
    sup2.supportedAttributeBits = buffer.getInt();
    sup2.supportedOpenFlags = buffer.getInt();
    sup2.supportedAccessMask = buffer.getInt();
    sup2.maxReadSize = buffer.getInt();
    sup2.supportedOpenBlockVector = buffer.getShort();
    sup2.supportedBlock = buffer.getShort();
    sup2.attribExtensionNames = buffer.getStringList(true);
    sup2.extensionNames = buffer.getStringList(true);
    return sup2;
  }
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

protected RequestHandler.Result handleWindowChange(Buffer buffer, boolean wantReply) throws IOException {
  int tColumns = buffer.getInt();
  int tRows = buffer.getInt();
  int tWidth = buffer.getInt();
  int tHeight = buffer.getInt();
  if (log.isDebugEnabled()) {
    log.debug("handleWindowChange({}): ({} - {}), ({}, {})", this, tColumns, tRows, tWidth, tHeight);
  }
  StandardEnvironment e = getEnvironment();
  e.set(Environment.ENV_COLUMNS, Integer.toString(tColumns));
  e.set(Environment.ENV_LINES, Integer.toString(tRows));
  e.signal(Signal.WINCH);
  return RequestHandler.Result.ReplySuccess;
}

代码示例来源:origin: org.apache.sshd/sshd-core

protected RequestHandler.Result handleWindowChange(Buffer buffer, boolean wantReply) throws IOException {
  int tColumns = buffer.getInt();
  int tRows = buffer.getInt();
  int tWidth = buffer.getInt();
  int tHeight = buffer.getInt();
  if (log.isDebugEnabled()) {
    log.debug("handleWindowChange({}): ({} - {}), ({}, {})",
         this, tColumns, tRows, tWidth, tHeight);
  }
  StandardEnvironment e = getEnvironment();
  e.set(Environment.ENV_COLUMNS, Integer.toString(tColumns));
  e.set(Environment.ENV_LINES, Integer.toString(tRows));
  e.signal(Signal.WINCH);
  return RequestHandler.Result.ReplySuccess;
}

代码示例来源:origin: org.apache.sshd/sshd-core

@Override
public void handleWindowAdjust(Buffer buffer) throws IOException {
  int window = buffer.getInt();
  if (log.isDebugEnabled()) {
    log.debug("handleWindowAdjust({}) SSH_MSG_CHANNEL_WINDOW_ADJUST window={}", this, window);
  }
  Window wRemote = getRemoteWindow();
  wRemote.expand(window);
  notifyStateChanged("SSH_MSG_CHANNEL_WINDOW_ADJUST");
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

public byte[] getBytes() {
  int reqLen = getInt();
  int len = ensureAvailable(reqLen);
  byte[] b = new byte[len];
  getRawBytes(b);
  return b;
}

代码示例来源:origin: org.apache.sshd/sshd-sftp

public static NavigableMap<String, byte[]> readExtensions(Buffer buffer) {
  int count = buffer.getInt();
  // NOTE
  NavigableMap<String, byte[]> extended = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
  for (int i = 0; i < count; i++) {
    String key = buffer.getString();
    byte[] val = buffer.getBytes();
    byte[] prev = extended.put(key, val);
    ValidateUtils.checkTrue(prev == null, "Duplicate values for extended key=%s", key);
  }
  return extended;
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

@Override
public void handleWindowAdjust(Buffer buffer) throws IOException {
  int window = buffer.getInt();
  if (log.isDebugEnabled()) {
    log.debug("handleWindowAdjust({}) SSH_MSG_CHANNEL_WINDOW_ADJUST window={}", this, window);
  }
  Window wRemote = getRemoteWindow();
  wRemote.expand(window);
  notifyStateChanged("SSH_MSG_CHANNEL_WINDOW_ADJUST");
}

代码示例来源:origin: org.apache.sshd/sshd-common

public byte[] getBytes() {
  int len = getInt();
  if (len < 0) {
    throw new BufferException("Bad item length: " + len);
  }
  ensureAvailable(len);
  byte[] b = new byte[len];
  getRawBytes(b);
  return b;
}

代码示例来源:origin: org.apache.sshd/sshd-core

protected void handleDisconnect(Buffer buffer) throws Exception  {
  int code = buffer.getInt();
  String message = buffer.getString();
  String languageTag;
  // SSHD-738: avoid spamming the log with uninteresting
  // messages caused by buggy OpenSSH < 5.5
  if (buffer.available() > 0) {
    languageTag = buffer.getString();
  } else {
    languageTag = "";
  }
  handleDisconnect(code, message, languageTag, buffer);
}

代码示例来源:origin: org.apache.sshd/sshd-sftp

public static void decode(Buffer buffer, SpaceAvailableExtensionInfo info) {
  info.bytesOnDevice = buffer.getLong();
  info.unusedBytesOnDevice = buffer.getLong();
  info.bytesAvailableToUser = buffer.getLong();
  info.unusedBytesAvailableToUser = buffer.getLong();
  info.bytesPerAllocationUnit = buffer.getInt();
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

protected void handleDisconnect(Buffer buffer) throws Exception  {
  int code = buffer.getInt();
  String message = buffer.getString();
  String languageTag;
  // SSHD-738: avoid spamming the log with uninteresting
  // messages caused by buggy OpenSSH < 5.5
  if (buffer.available() > 0) {
    languageTag = buffer.getString();
  } else {
    languageTag = "";
  }
  handleDisconnect(code, message, languageTag, buffer);
}

代码示例来源:origin: org.apache.sshd/sshd-sftp

public static List<AclEntry> readACLs(Buffer buffer, int version) {
  int aclSize = buffer.getInt();
  int startPos = buffer.rpos();
  Buffer aclBuffer = new ByteArrayBuffer(buffer.array(), startPos, aclSize, true);
  List<AclEntry> acl = decodeACLs(aclBuffer, version);
  buffer.rpos(startPos + aclSize);
  return acl;
}

代码示例来源:origin: org.apache.sshd/sshd-sftp

protected void doBlock(Buffer buffer, int id) throws IOException {
  String handle = buffer.getString();
  long offset = buffer.getLong();
  long length = buffer.getLong();
  int mask = buffer.getInt();
  try {
    doBlock(id, handle, offset, length, mask);
  } catch (IOException | RuntimeException e) {
    sendStatus(prepareReply(buffer), id, e, SftpConstants.SSH_FXP_BLOCK, handle, offset, length, mask);
    return;
  }
  sendStatus(prepareReply(buffer), id, SftpConstants.SSH_FX_OK, "");
}

代码示例来源:origin: org.apache.sshd/sshd-sftp

protected void doWrite(Buffer buffer, int id) throws IOException {
  String handle = buffer.getString();
  long offset = buffer.getLong();
  int length = buffer.getInt();
  try {
    doWrite(id, handle, offset, length, buffer.array(), buffer.rpos(), buffer.available());
  } catch (IOException | RuntimeException e) {
    sendStatus(prepareReply(buffer), id, e, SftpConstants.SSH_FXP_WRITE, handle, offset, length);
    return;
  }
  sendStatus(prepareReply(buffer), id, SftpConstants.SSH_FX_OK, "");
}

相关文章