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

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

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

Buffer.putByte介绍

暂无

代码示例

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

public synchronized void write(int c) {
  buffer.putByte((byte) c);
}

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

public synchronized void write(int c) {
  buffer.putByte((byte) c);
}

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

public void putBoolean(boolean b) {
  putByte(b ? (byte) 1 : (byte) 0);
}

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

public void putBoolean(boolean b) {
  putByte(b ? (byte) 1 : (byte) 0);
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit.ssh.apache

@Override
public Buffer getToken() throws Exception {
  if (token == null) {
    return null;
  }
  Buffer buffer = new ByteArrayBuffer(4 + token.length, false);
  buffer.putByte(SOCKS5_GSSAPI_VERSION);
  buffer.putByte(SOCKS5_GSSAPI_TOKEN);
  buffer.putByte((byte) ((token.length >> 8) & 0xFF));
  buffer.putByte((byte) (token.length & 0xFF));
  buffer.putRawBytes(token);
  return buffer;
}

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

protected Buffer createBuffer(byte cmd, int extraLen) {
  Buffer buffer = new ByteArrayBuffer((extraLen <= 0) ? ByteArrayBuffer.DEFAULT_SIZE : extraLen + Byte.SIZE, false);
  buffer.putInt(0);
  buffer.putByte(cmd);
  return buffer;
}

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

protected Buffer createBuffer(byte cmd, int extraLen) {
  Buffer buffer = new ByteArrayBuffer((extraLen <= 0) ? ByteArrayBuffer.DEFAULT_SIZE : extraLen + Byte.SIZE, false);
  buffer.putInt(0);
  buffer.putByte(cmd);
  return buffer;
}

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

protected void sendHandle(Buffer buffer, int id, String handle) throws IOException {
  buffer.putByte((byte) SftpConstants.SSH_FXP_HANDLE);
  buffer.putInt(id);
  buffer.putString(handle);
  send(buffer);
}

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

@Override
public Buffer prepareBuffer(byte cmd, Buffer buffer) {
  buffer = validateTargetBuffer(cmd & 0xFF, buffer);
  buffer.rpos(SshConstants.SSH_PACKET_HEADER_LEN);
  buffer.wpos(SshConstants.SSH_PACKET_HEADER_LEN);
  buffer.putByte(cmd);
  return buffer;
}

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

@Override
public Buffer prepareBuffer(byte cmd, Buffer buffer) {
  buffer = validateTargetBuffer(cmd & 0xFF, buffer);
  buffer.rpos(SshConstants.SSH_PACKET_HEADER_LEN);
  buffer.wpos(SshConstants.SSH_PACKET_HEADER_LEN);
  buffer.putByte(cmd);
  return buffer;
}

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

protected void sendAttrs(Buffer buffer, int id, Map<String, ?> attributes) throws IOException {
  buffer.putByte((byte) SftpConstants.SSH_FXP_ATTRS);
  buffer.putInt(id);
  writeAttrs(buffer, attributes);
  send(buffer);
}

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

public void putMPInt(byte[] foo) {
  if ((foo[0] & 0x80) != 0) {
    putInt(foo.length + 1 /* padding */);
    putByte((byte) 0);
  } else {
    putInt(foo.length);
  }
  putRawBytes(foo);
}

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

public void putMPInt(byte[] foo) {
  if ((foo[0] & 0x80) != 0) {
    putInt(foo.length + 1 /* padding */);
    putByte((byte) 0);
  } else {
    putInt(foo.length);
  }
  putRawBytes(foo);
}

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

@Override
public void mkdir(String path) throws IOException {
  if (!isOpen()) {
    throw new IOException("mkdir(" + path + ") client is closed");
  }
  if (log.isDebugEnabled()) {
    log.debug("mkdir({}) {}", getClientSession(), path);
  }
  Buffer buffer = new ByteArrayBuffer(path.length() + Long.SIZE /* some extra fields */, false);
  buffer = putReferencedName(SftpConstants.SSH_FXP_MKDIR, buffer, path, 0);
  buffer.putInt(0);
  int version = getVersion();
  if (version != SftpConstants.SFTP_V3) {
    buffer.putByte((byte) 0);
  }
  checkCommandStatus(SftpConstants.SSH_FXP_MKDIR, buffer);
}

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

protected void sendStatus(Buffer buffer, int id, int substatus, String msg, String lang) throws IOException {
  if (log.isDebugEnabled()) {
    log.debug("doSendStatus({})[id={}] SSH_FXP_STATUS (substatus={}, lang={}, msg={})",
         getServerSession(), id, SftpConstants.getStatusName(substatus), lang, msg);
  }
  buffer.putByte((byte) SftpConstants.SSH_FXP_STATUS);
  buffer.putInt(id);
  buffer.putInt(substatus);
  buffer.putString(msg);
  buffer.putString(lang);
  send(buffer);
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit.ssh.apache

@Override
public void sendClientProxyMetadata(ClientSession sshSession)
    throws Exception {
  init(sshSession);
  IoSession session = sshSession.getIoSession();
  // Send the initial request
  Buffer buffer = new ByteArrayBuffer(5, false);
  buffer.putByte(SOCKS_VERSION_5);
  context = getGSSContext(remoteAddress);
  authenticationProposals = getAuthenticationProposals();
  buffer.putByte((byte) authenticationProposals.length);
  buffer.putRawBytes(authenticationProposals);
  state = ProtocolState.INIT;
  session.writePacket(buffer).verify(getTimeout());
}

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

protected Buffer insertCharacter(Buffer org, int c) {
  int remaining = org.capacity();
  int readPos = org.rpos();
  // see if can accommodate the character in the original buffer
  if ((remaining > 0) && (readPos > 0)) {
    int writePos = org.wpos();
    org.wpos(readPos - 1);
    org.putByte((byte) c);
    org.wpos(writePos);
    org.rpos(readPos - 1);
    return org;
  } else {
    Buffer buf = new ByteArrayBuffer(org.available() + Byte.SIZE, false);
    buf.putByte((byte) c);
    buf.putBuffer(org);
    return buf;
  }
}

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

protected Buffer insertCharacter(Buffer org, int c) {
  int remaining = org.capacity();
  int readPos = org.rpos();
  // see if can accommodate the character in the original buffer
  if ((remaining > 0) && (readPos > 0)) {
    int writePos = org.wpos();
    org.wpos(readPos - 1);
    org.putByte((byte) c);
    org.wpos(writePos);
    org.rpos(readPos - 1);
    return org;
  } else {
    Buffer buf = new ByteArrayBuffer(org.available() + Byte.SIZE, false);
    buf.putByte((byte) c);
    buf.putBuffer(org);
    return buf;
  }
}

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

protected void sendPath(Buffer buffer, int id, Path f, Map<String, ?> attrs) throws IOException {
  buffer.putByte((byte) SftpConstants.SSH_FXP_NAME);
  buffer.putInt(id);
  buffer.putInt(1);   // one reply
  String originalPath = f.toString();
  //in case we are running on Windows
  String unixPath = originalPath.replace(File.separatorChar, '/');
  buffer.putString(unixPath);
  int version = getVersion();
  if (version == SftpConstants.SFTP_V3) {
    buffer.putString(getLongName(f, getShortName(f), attrs));
  }
  writeAttrs(buffer, attrs);
  SftpHelper.indicateEndOfNamesList(buffer, getVersion(), getServerSession());
  send(buffer);
}

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

protected void doSpaceAvailable(Buffer buffer, int id) throws IOException {
  String path = buffer.getString();
  SpaceAvailableExtensionInfo info;
  try {
    info = doSpaceAvailable(id, path);
  } catch (IOException | RuntimeException e) {
    sendStatus(prepareReply(buffer), id, e, SftpConstants.SSH_FXP_EXTENDED, SftpConstants.EXT_SPACE_AVAILABLE, path);
    return;
  }
  buffer = prepareReply(buffer);
  buffer.putByte((byte) SftpConstants.SSH_FXP_EXTENDED_REPLY);
  buffer.putInt(id);
  SpaceAvailableExtensionInfo.encode(buffer, info);
  send(buffer);
}

相关文章