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

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

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

Buffer.rpos介绍

暂无

代码示例

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

@Override
  protected void reply(Buffer buf) throws IOException {
    out.write(buf.array(), buf.rpos(), buf.available());
    out.flush();
  }
}

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

@Override
  public String toString() {
    return getClass().getSimpleName()
      + "[rpos=" + rpos()
      + ", wpos=" + wpos()
      + ", size=" + size()
      + "]";
  }
}

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

@Override
  protected void reply(Buffer buf) throws IOException {
    out.write(buf.array(), buf.rpos(), buf.available());
    out.flush();
  }
}

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

@Override
public void compress(Buffer buffer) throws IOException {
  compresser.setInput(buffer.array(), buffer.rpos(), buffer.available());
  buffer.wpos(buffer.rpos());
  for (int len = compresser.deflate(tmpbuf, 0, tmpbuf.length, Deflater.SYNC_FLUSH);
      len > 0;
      len = compresser.deflate(tmpbuf, 0, tmpbuf.length, Deflater.SYNC_FLUSH)) {
    buffer.putRawBytes(tmpbuf, 0, len);
  }
}

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

@Override
  public void uncompress(Buffer from, Buffer to) throws IOException {
    decompresser.setInput(from.array(), from.rpos(), from.available());
    try {
      for (int len = decompresser.inflate(tmpbuf); len > 0; len = decompresser.inflate(tmpbuf)) {
        to.putRawBytes(tmpbuf, 0, len);
      }
    } catch (DataFormatException e) {
      throw new IOException("Error decompressing data", e);
    }
  }
}

代码示例来源:origin: termd/termd

private void queueRequest(final Buffer msg) {
    msg.rpos(0);
    pending.add(msg);
  }
}

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

@Override
  public void uncompress(Buffer from, Buffer to) throws IOException {
    decompresser.setInput(from.array(), from.rpos(), from.available());
    try {
      for (int len = decompresser.inflate(tmpbuf); len > 0; len = decompresser.inflate(tmpbuf)) {
        to.putRawBytes(tmpbuf, 0, len);
      }
    } catch (DataFormatException e) {
      throw new IOException("Error decompressing data", e);
    }
  }
}

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

protected void onMessage(Buffer buffer) throws IOException {
  OutputStream invertedIn = channel.getInvertedIn();
  invertedIn.write(buffer.array(), buffer.rpos(), buffer.available());
  invertedIn.flush();
}

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

@Override
  public String toString() {
    return "Buffer [rpos=" + rpos() + ", wpos=" + wpos() + ", size=" + size() + "]";
  }
}

代码示例来源: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-osgi

protected void onMessage(Buffer buffer) throws IOException {
  OutputStream invertedIn = channel.getInvertedIn();
  invertedIn.write(buffer.array(), buffer.rpos(), buffer.available());
  invertedIn.flush();
}

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

protected Buffer prepare(Buffer buf) {
  int len = buf.available();
  int rpos = buf.rpos();
  int wpos = buf.wpos();
  buf.rpos(rpos - 4);
  buf.wpos(rpos - 4);
  buf.putInt(len);
  buf.wpos(wpos);
  return buf;
}

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

protected Buffer prepare(Buffer buf) {
  int len = buf.available();
  int rpos = buf.rpos();
  int wpos = buf.wpos();
  buf.rpos(rpos - 4);
  buf.wpos(rpos - 4);
  buf.putInt(len);
  buf.wpos(wpos);
  return buf;
}

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

@SuppressWarnings("synthetic-access")
@Override
protected void reply(Buffer buf) throws IOException {
  int result = Socket.send(socket, buf.array(), buf.rpos(), buf.available());
  if (result < Status.APR_SUCCESS) {
    throwException(result);
  }
}

代码示例来源: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-core

@SuppressWarnings("synthetic-access")
@Override
protected void reply(Buffer buf) throws IOException {
  int result = Socket.send(socket, buf.array(), buf.rpos(), buf.available());
  if (result < Status.APR_SUCCESS) {
    throwException(result);
  }
}

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

@Override
public void messageReceived(IoSession session, Readable message) throws Exception {
  ChannelForwardedX11 channel = (ChannelForwardedX11) session.getAttribute(ChannelForwardedX11.class);
  Buffer buffer = new ByteArrayBuffer(message.available() + Long.SIZE, false);
  buffer.putBuffer(message);
  if (log.isTraceEnabled()) {
    log.trace("messageReceived({}) channel={}, len={}", session, channel, buffer.available());
  }
  OutputStream outputStream = channel.getInvertedIn();
  outputStream.write(buffer.array(), buffer.rpos(), buffer.available());
  outputStream.flush();
}

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

@Override
public void messageReceived(IoSession session, Readable message) throws Exception {
  ChannelForwardedX11 channel = (ChannelForwardedX11) session.getAttribute(ChannelForwardedX11.class);
  Buffer buffer = new ByteArrayBuffer(message.available() + Long.SIZE, false);
  buffer.putBuffer(message);
  if (log.isTraceEnabled()) {
    log.trace("messageReceived({}) channel={}, len={}", session, channel, buffer.available());
  }
  OutputStream outputStream = channel.getInvertedIn();
  outputStream.write(buffer.array(), buffer.rpos(), buffer.available());
  outputStream.flush();
}

代码示例来源: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, "");
}

相关文章