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

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

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

Buffer.putRawBytes介绍

暂无

代码示例

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

public abstract void putRawBytes(byte[] d, int off, int len);

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

public void putByte(byte b) {
  ensureCapacity(Byte.BYTES);
  workBuf[0] = b;
  putRawBytes(workBuf, 0, Byte.BYTES);
}

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

public void putByte(byte b) {
  ensureCapacity(Byte.BYTES);
  workBuf[0] = b;
  putRawBytes(workBuf, 0, Byte.BYTES);
}

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

public void putBytes(byte[] b, int off, int len) {
  putInt(len);
  putRawBytes(b, off, len);
}

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

/**
 * Writes 16 bits
 *
 * @param i The 16-bit value
 */
public void putShort(int i) {
  ensureCapacity(Short.BYTES);
  workBuf[0] = (byte) (i >> 8);
  workBuf[1] = (byte) i;
  putRawBytes(workBuf, 0, Short.BYTES);
}

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

/**
 * Writes 16 bits
 *
 * @param i The 16-bit value
 */
public void putShort(int i) {
  ensureCapacity(Short.BYTES);
  workBuf[0] = (byte) (i >> 8);
  workBuf[1] = (byte) i;
  putRawBytes(workBuf, 0, Short.BYTES);
}

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

public void putBytes(byte[] b, int off, int len) {
  putInt(len);
  putRawBytes(b, off, len);
}

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

@Override
  public void receive(byte[] bytes, int off, int len) throws IOException {
    lock.lock();
    try {
      if (writerClosed.get() || (!isOpen())) {
        throw new IOException("Pipe closed");
      }
      buffer.putRawBytes(bytes, off, len);
      dataAvailable.signalAll();
    } finally {
      lock.unlock();
    }
  }
}

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

@Override
  public void receive(byte[] bytes, int off, int len) throws IOException {
    lock.lock();
    try {
      if (writerClosed.get() || (!isOpen())) {
        throw new IOException("Pipe closed");
      }
      buffer.putRawBytes(bytes, off, len);
      dataAvailable.signalAll();
    } finally {
      lock.unlock();
    }
  }
}

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

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.eclipse.jgit/org.eclipse.jgit.ssh.apache

private void send(StringBuilder msg, IoSession session) throws Exception {
  byte[] data = eol(msg).toString().getBytes(StandardCharsets.US_ASCII);
  Buffer buffer = new ByteArrayBuffer(data.length, false);
  buffer.putRawBytes(data);
  session.writePacket(buffer).verify(getTimeout());
}

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

/**
 * Writes 32 bits
 *
 * @param i The 32-bit value
 */
public void putInt(long i) {
  BufferUtils.validateInt32Value(i, "Invalid 32-bit value: %d");
  ensureCapacity(Integer.BYTES);
  BufferUtils.putUInt(i, workBuf, 0, Integer.BYTES);
  putRawBytes(workBuf, 0, Integer.BYTES);
}

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

/**
 * Writes 32 bits
 *
 * @param i The 32-bit value
 */
public void putInt(long i) {
  BufferUtils.validateInt32Value(i, "Invalid 32-bit value: %d");
  ensureCapacity(Integer.BYTES);
  BufferUtils.putUInt(i, workBuf, 0, Integer.BYTES);
  putRawBytes(workBuf, 0, Integer.BYTES);
}

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

相关文章