本文整理了Java中org.apache.sshd.common.util.buffer.Buffer.array()
方法的一些代码示例,展示了Buffer.array()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.array()
方法的具体详情如下:
包路径:org.apache.sshd.common.util.buffer.Buffer
类名称:Buffer
方法名:array
暂无
代码示例来源: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
protected void reply(Buffer buf) throws IOException {
out.write(buf.array(), buf.rpos(), buf.available());
out.flush();
}
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit.ssh.apache
public void handleMessage(Socks5ClientConnector connector,
@SuppressWarnings("unused") IoSession session, Buffer data)
throws Exception {
throw new IOException(
format(SshdText.get().proxySocksUnexpectedMessage,
connector.proxyAddress, this,
BufferUtils.toHex(data.array())));
}
}
代码示例来源: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
public byte[] getCompactData() {
int l = available();
if (l > 0) {
byte[] b = new byte[l];
System.arraycopy(array(), rpos(), b, 0, l);
return b;
} else {
return GenericUtils.EMPTY_BYTE_ARRAY;
}
}
代码示例来源:origin: org.apache.sshd/sshd-osgi
public byte[] getCompactData() {
int l = available();
if (l > 0) {
byte[] b = new byte[l];
System.arraycopy(array(), rpos(), b, 0, l);
return b;
} else {
return GenericUtils.EMPTY_BYTE_ARRAY;
}
}
代码示例来源: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-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-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
@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
@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-common
public static byte[] getRawFingerprint(Digest d, PublicKey key) throws Exception {
if (key == null) {
return null;
}
Buffer buffer = new ByteArrayBuffer();
buffer.putRawPublicKey(key);
return DigestUtils.getRawFingerprint(d, buffer.array(), 0, buffer.wpos());
}
代码示例来源:origin: org.apache.sshd/sshd-osgi
public static byte[] getRawFingerprint(Digest d, PublicKey key) throws Exception {
if (key == null) {
return null;
}
Buffer buffer = new ByteArrayBuffer();
buffer.putRawPublicKey(key);
return DigestUtils.getRawFingerprint(d, buffer.array(), 0, buffer.wpos());
}
代码示例来源:origin: org.apache.sshd/sshd-core
@Override
protected void doWriteData(byte[] data, int off, long len) throws IOException {
ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length exceeds int boundaries: %d", len);
// Make sure we copy the data as the incoming buffer may be reused
Buffer buf = ByteArrayBuffer.getCompactClone(data, off, (int) len);
ioSession.writePacket(buf).addListener(future -> {
if (future.isWritten()) {
handleWriteDataSuccess(SshConstants.SSH_MSG_CHANNEL_DATA, buf.array(), 0, (int) len);
} else {
handleWriteDataFailure(SshConstants.SSH_MSG_CHANNEL_DATA, buf.array(), 0, (int) len, future.getException());
}
});
}
代码示例来源: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 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, "");
}
内容来源于网络,如有侵权,请联系作者删除!