repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFileAttributes.java | SftpFileAttributes.isCharacter | public boolean isCharacter() {
if (permissions != null
&& (permissions.longValue() & SftpFileAttributes.S_IFCHR) == SftpFileAttributes.S_IFCHR) {
return true;
}
return false;
} | java | public boolean isCharacter() {
if (permissions != null
&& (permissions.longValue() & SftpFileAttributes.S_IFCHR) == SftpFileAttributes.S_IFCHR) {
return true;
}
return false;
} | [
"public",
"boolean",
"isCharacter",
"(",
")",
"{",
"if",
"(",
"permissions",
"!=",
"null",
"&&",
"(",
"permissions",
".",
"longValue",
"(",
")",
"&",
"SftpFileAttributes",
".",
"S_IFCHR",
")",
"==",
"SftpFileAttributes",
".",
"S_IFCHR",
")",
"{",
"return",
... | Determine whether these attributes refer to a character device.
@return boolean | [
"Determine",
"whether",
"these",
"attributes",
"refer",
"to",
"a",
"character",
"device",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFileAttributes.java#L951-L957 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFileAttributes.java | SftpFileAttributes.isSocket | public boolean isSocket() {
if (permissions != null
&& (permissions.longValue() & SftpFileAttributes.S_IFSOCK) == SftpFileAttributes.S_IFSOCK) {
return true;
}
return false;
} | java | public boolean isSocket() {
if (permissions != null
&& (permissions.longValue() & SftpFileAttributes.S_IFSOCK) == SftpFileAttributes.S_IFSOCK) {
return true;
}
return false;
} | [
"public",
"boolean",
"isSocket",
"(",
")",
"{",
"if",
"(",
"permissions",
"!=",
"null",
"&&",
"(",
"permissions",
".",
"longValue",
"(",
")",
"&",
"SftpFileAttributes",
".",
"S_IFSOCK",
")",
"==",
"SftpFileAttributes",
".",
"S_IFSOCK",
")",
"{",
"return",
... | Determine whether these attributes refer to a socket.
@return boolean | [
"Determine",
"whether",
"these",
"attributes",
"refer",
"to",
"a",
"socket",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFileAttributes.java#L964-L970 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/JCEProvider.java | JCEProvider.getProviderForAlgorithm | public static Provider getProviderForAlgorithm(String jceAlgorithm) {
if (specficProviders.containsKey(jceAlgorithm)) {
return (Provider) specficProviders.get(jceAlgorithm);
}
return defaultProvider;
} | java | public static Provider getProviderForAlgorithm(String jceAlgorithm) {
if (specficProviders.containsKey(jceAlgorithm)) {
return (Provider) specficProviders.get(jceAlgorithm);
}
return defaultProvider;
} | [
"public",
"static",
"Provider",
"getProviderForAlgorithm",
"(",
"String",
"jceAlgorithm",
")",
"{",
"if",
"(",
"specficProviders",
".",
"containsKey",
"(",
"jceAlgorithm",
")",
")",
"{",
"return",
"(",
"Provider",
")",
"specficProviders",
".",
"get",
"(",
"jceAl... | Get the provider for a specific algorithm.
@param jceAlgorithm
@return Provider | [
"Get",
"the",
"provider",
"for",
"a",
"specific",
"algorithm",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/JCEProvider.java#L80-L86 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/JCEProvider.java | JCEProvider.getSecureRandom | public static SecureRandom getSecureRandom()
throws NoSuchAlgorithmException {
if (secureRandom == null) {
try {
return secureRandom = JCEProvider
.getProviderForAlgorithm(JCEProvider
.getSecureRandomAlgorithm()) == null ? SecureRandom
.getInstance(JCEProvider.getSecureRandomAlgorithm()... | java | public static SecureRandom getSecureRandom()
throws NoSuchAlgorithmException {
if (secureRandom == null) {
try {
return secureRandom = JCEProvider
.getProviderForAlgorithm(JCEProvider
.getSecureRandomAlgorithm()) == null ? SecureRandom
.getInstance(JCEProvider.getSecureRandomAlgorithm()... | [
"public",
"static",
"SecureRandom",
"getSecureRandom",
"(",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"if",
"(",
"secureRandom",
"==",
"null",
")",
"{",
"try",
"{",
"return",
"secureRandom",
"=",
"JCEProvider",
".",
"getProviderForAlgorithm",
"(",
"JCEProvider... | Get the secure random implementation for the API.
@return SecureRandom
@throws NoSuchAlgorithmException | [
"Get",
"the",
"secure",
"random",
"implementation",
"for",
"the",
"API",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/JCEProvider.java#L94-L114 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/DirectoryOperation.java | DirectoryOperation.containsFile | public boolean containsFile(File f) {
return unchangedFiles.contains(f) || newFiles.contains(f)
|| updatedFiles.contains(f) || deletedFiles.contains(f)
|| recursedDirectories.contains(f)
|| failedTransfers.containsKey(f);
} | java | public boolean containsFile(File f) {
return unchangedFiles.contains(f) || newFiles.contains(f)
|| updatedFiles.contains(f) || deletedFiles.contains(f)
|| recursedDirectories.contains(f)
|| failedTransfers.containsKey(f);
} | [
"public",
"boolean",
"containsFile",
"(",
"File",
"f",
")",
"{",
"return",
"unchangedFiles",
".",
"contains",
"(",
"f",
")",
"||",
"newFiles",
".",
"contains",
"(",
"f",
")",
"||",
"updatedFiles",
".",
"contains",
"(",
"f",
")",
"||",
"deletedFiles",
"."... | Determine whether the operation contains a file.
@param f
@return boolean | [
"Determine",
"whether",
"the",
"operation",
"contains",
"a",
"file",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/DirectoryOperation.java#L154-L159 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/DirectoryOperation.java | DirectoryOperation.containsFile | public boolean containsFile(SftpFile f) {
return unchangedFiles.contains(f) || newFiles.contains(f)
|| updatedFiles.contains(f) || deletedFiles.contains(f)
|| recursedDirectories.contains(f.getAbsolutePath())
|| failedTransfers.containsKey(f);
} | java | public boolean containsFile(SftpFile f) {
return unchangedFiles.contains(f) || newFiles.contains(f)
|| updatedFiles.contains(f) || deletedFiles.contains(f)
|| recursedDirectories.contains(f.getAbsolutePath())
|| failedTransfers.containsKey(f);
} | [
"public",
"boolean",
"containsFile",
"(",
"SftpFile",
"f",
")",
"{",
"return",
"unchangedFiles",
".",
"contains",
"(",
"f",
")",
"||",
"newFiles",
".",
"contains",
"(",
"f",
")",
"||",
"updatedFiles",
".",
"contains",
"(",
"f",
")",
"||",
"deletedFiles",
... | Determine whether the directory operation contains an SftpFile
@param f
@return boolean | [
"Determine",
"whether",
"the",
"directory",
"operation",
"contains",
"an",
"SftpFile"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/DirectoryOperation.java#L167-L172 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/DirectoryOperation.java | DirectoryOperation.addDirectoryOperation | public void addDirectoryOperation(DirectoryOperation op, File f) {
addAll(op.getUpdatedFiles(), updatedFiles);
addAll(op.getNewFiles(), newFiles);
addAll(op.getUnchangedFiles(), unchangedFiles);
addAll(op.getDeletedFiles(), deletedFiles);
Object obj;
for (Enumeration e = op.failedTransfers.keys(); e.hasMor... | java | public void addDirectoryOperation(DirectoryOperation op, File f) {
addAll(op.getUpdatedFiles(), updatedFiles);
addAll(op.getNewFiles(), newFiles);
addAll(op.getUnchangedFiles(), unchangedFiles);
addAll(op.getDeletedFiles(), deletedFiles);
Object obj;
for (Enumeration e = op.failedTransfers.keys(); e.hasMor... | [
"public",
"void",
"addDirectoryOperation",
"(",
"DirectoryOperation",
"op",
",",
"File",
"f",
")",
"{",
"addAll",
"(",
"op",
".",
"getUpdatedFiles",
"(",
")",
",",
"updatedFiles",
")",
";",
"addAll",
"(",
"op",
".",
"getNewFiles",
"(",
")",
",",
"newFiles"... | Add the contents of another directory operation. This is used to record
changes when recuring through directories.
@param op
@param f | [
"Add",
"the",
"contents",
"of",
"another",
"directory",
"operation",
".",
"This",
"is",
"used",
"to",
"record",
"changes",
"when",
"recuring",
"through",
"directories",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/DirectoryOperation.java#L181-L194 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/DirectoryOperation.java | DirectoryOperation.getTransferSize | public long getTransferSize() throws SftpStatusException, SshException {
Object obj;
long size = 0;
SftpFile sftpfile;
File file;
for (Enumeration e = newFiles.elements(); e.hasMoreElements();) {
obj = e.nextElement();
if (obj instanceof File) {
file = (File) obj;
if (file.isFile()) {
size... | java | public long getTransferSize() throws SftpStatusException, SshException {
Object obj;
long size = 0;
SftpFile sftpfile;
File file;
for (Enumeration e = newFiles.elements(); e.hasMoreElements();) {
obj = e.nextElement();
if (obj instanceof File) {
file = (File) obj;
if (file.isFile()) {
size... | [
"public",
"long",
"getTransferSize",
"(",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"Object",
"obj",
";",
"long",
"size",
"=",
"0",
";",
"SftpFile",
"sftpfile",
";",
"File",
"file",
";",
"for",
"(",
"Enumeration",
"e",
"=",
"newFiles",
... | Get the total number of bytes that this operation will transfer
@return long | [
"Get",
"the",
"total",
"number",
"of",
"bytes",
"that",
"this",
"operation",
"will",
"transfer"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/DirectoryOperation.java#L238-L277 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java | ByteArrayWriter.writeBigInteger | public void writeBigInteger(BigInteger bi) throws IOException {
byte[] raw = bi.toByteArray();
writeInt(raw.length);
write(raw);
} | java | public void writeBigInteger(BigInteger bi) throws IOException {
byte[] raw = bi.toByteArray();
writeInt(raw.length);
write(raw);
} | [
"public",
"void",
"writeBigInteger",
"(",
"BigInteger",
"bi",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"raw",
"=",
"bi",
".",
"toByteArray",
"(",
")",
";",
"writeInt",
"(",
"raw",
".",
"length",
")",
";",
"write",
"(",
"raw",
")",
";",
"}... | Write a BigInteger to the array.
@param bi
@throws IOException | [
"Write",
"a",
"BigInteger",
"to",
"the",
"array",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java#L77-L82 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java | ByteArrayWriter.writeInt | public void writeInt(long i) throws IOException {
byte[] raw = new byte[4];
raw[0] = (byte) (i >> 24);
raw[1] = (byte) (i >> 16);
raw[2] = (byte) (i >> 8);
raw[3] = (byte) (i);
write(raw);
} | java | public void writeInt(long i) throws IOException {
byte[] raw = new byte[4];
raw[0] = (byte) (i >> 24);
raw[1] = (byte) (i >> 16);
raw[2] = (byte) (i >> 8);
raw[3] = (byte) (i);
write(raw);
} | [
"public",
"void",
"writeInt",
"(",
"long",
"i",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"raw",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"raw",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"i",
">>",
"24",
")",
";",
"raw",
"[",
"1",
... | Write an integer to the array
@param i
@throws IOException | [
"Write",
"an",
"integer",
"to",
"the",
"array"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java#L147-L156 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java | ByteArrayWriter.encodeInt | public static byte[] encodeInt(int i) {
byte[] raw = new byte[4];
raw[0] = (byte) (i >> 24);
raw[1] = (byte) (i >> 16);
raw[2] = (byte) (i >> 8);
raw[3] = (byte) (i);
return raw;
} | java | public static byte[] encodeInt(int i) {
byte[] raw = new byte[4];
raw[0] = (byte) (i >> 24);
raw[1] = (byte) (i >> 16);
raw[2] = (byte) (i >> 8);
raw[3] = (byte) (i);
return raw;
} | [
"public",
"static",
"byte",
"[",
"]",
"encodeInt",
"(",
"int",
"i",
")",
"{",
"byte",
"[",
"]",
"raw",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"raw",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"i",
">>",
"24",
")",
";",
"raw",
"[",
"1",
"... | Encode an integer into a 4 byte array.
@param i
@return a byte[4] containing the encoded integer. | [
"Encode",
"an",
"integer",
"into",
"a",
"4",
"byte",
"array",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java#L181-L188 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java | ByteArrayWriter.writeString | public void writeString(String str, String charset) throws IOException {
if (str == null) {
writeInt(0);
} else {
byte[] tmp;
if (ByteArrayReader.encode)
tmp = str.getBytes(charset);
else
tmp = str.getBytes();
writeInt(tmp.length);
write(tmp);
}
} | java | public void writeString(String str, String charset) throws IOException {
if (str == null) {
writeInt(0);
} else {
byte[] tmp;
if (ByteArrayReader.encode)
tmp = str.getBytes(charset);
else
tmp = str.getBytes();
writeInt(tmp.length);
write(tmp);
}
} | [
"public",
"void",
"writeString",
"(",
"String",
"str",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"writeInt",
"(",
"0",
")",
";",
"}",
"else",
"{",
"byte",
"[",
"]",
"tmp",
";",
"if",
"(",... | Write a String to the byte array converting the bytes using the given
character set.
@param str
@param charset
@throws IOException | [
"Write",
"a",
"String",
"to",
"the",
"byte",
"array",
"converting",
"the",
"bytes",
"using",
"the",
"given",
"character",
"set",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java#L240-L255 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.initialize | public void initialize() throws SshException, UnsupportedEncodingException {
// Initialize the SFTP subsystem
try {
Packet packet = createPacket();
packet.write(SSH_FXP_INIT);
packet.writeInt(this_MAX_VERSION);
sendMessage(packet);
byte[] msg = nextMessage();
if (msg[0] != SSH_FXP_VERSION) {
... | java | public void initialize() throws SshException, UnsupportedEncodingException {
// Initialize the SFTP subsystem
try {
Packet packet = createPacket();
packet.write(SSH_FXP_INIT);
packet.writeInt(this_MAX_VERSION);
sendMessage(packet);
byte[] msg = nextMessage();
if (msg[0] != SSH_FXP_VERSION) {
... | [
"public",
"void",
"initialize",
"(",
")",
"throws",
"SshException",
",",
"UnsupportedEncodingException",
"{",
"// Initialize the SFTP subsystem",
"try",
"{",
"Packet",
"packet",
"=",
"createPacket",
"(",
")",
";",
"packet",
".",
"write",
"(",
"SSH_FXP_INIT",
")",
... | Initializes the sftp subsystem and negotiates a version with the server.
This method must be the first method called after the channel has been
opened. This implementation current supports SFTP protocol version 4 and
below.
@throws SshException
@throws UnsupportedEncodingException | [
"Initializes",
"the",
"sftp",
"subsystem",
"and",
"negotiates",
"a",
"version",
"with",
"the",
"server",
".",
"This",
"method",
"must",
"be",
"the",
"first",
"method",
"called",
"after",
"the",
"channel",
"has",
"been",
"opened",
".",
"This",
"implementation",... | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L237-L289 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.setCharsetEncoding | public void setCharsetEncoding(String charset) throws SshException,
UnsupportedEncodingException {
if (version == -1)
throw new SshException(
"SFTP Channel must be initialized before setting character set encoding",
SshException.BAD_API_USAGE);
String test = "123456890";
test.getBytes(charset);
... | java | public void setCharsetEncoding(String charset) throws SshException,
UnsupportedEncodingException {
if (version == -1)
throw new SshException(
"SFTP Channel must be initialized before setting character set encoding",
SshException.BAD_API_USAGE);
String test = "123456890";
test.getBytes(charset);
... | [
"public",
"void",
"setCharsetEncoding",
"(",
"String",
"charset",
")",
"throws",
"SshException",
",",
"UnsupportedEncodingException",
"{",
"if",
"(",
"version",
"==",
"-",
"1",
")",
"throw",
"new",
"SshException",
"(",
"\"SFTP Channel must be initialized before setting ... | Allows the default character encoding to be overriden for filename
strings. This method should only be called once the channel has been
initialized, if the version of the protocol is less than or equal to 3
the encoding is defaulted to latin1 as no encoding is specified by the
protocol. If the version is greater than 3... | [
"Allows",
"the",
"default",
"character",
"encoding",
"to",
"be",
"overriden",
"for",
"filename",
"strings",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"once",
"the",
"channel",
"has",
"been",
"initialized",
"if",
"the",
"version",
"of",
"the",
... | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L308-L319 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.sendExtensionMessage | public SftpMessage sendExtensionMessage(String request, byte[] requestData)
throws SshException, SftpStatusException {
try {
UnsignedInteger32 id = nextRequestId();
Packet packet = createPacket();
packet.write(SSH_FXP_EXTENDED);
packet.writeUINT32(id);
packet.writeString(request);
sendMessage(p... | java | public SftpMessage sendExtensionMessage(String request, byte[] requestData)
throws SshException, SftpStatusException {
try {
UnsignedInteger32 id = nextRequestId();
Packet packet = createPacket();
packet.write(SSH_FXP_EXTENDED);
packet.writeUINT32(id);
packet.writeString(request);
sendMessage(p... | [
"public",
"SftpMessage",
"sendExtensionMessage",
"(",
"String",
"request",
",",
"byte",
"[",
"]",
"requestData",
")",
"throws",
"SshException",
",",
"SftpStatusException",
"{",
"try",
"{",
"UnsignedInteger32",
"id",
"=",
"nextRequestId",
"(",
")",
";",
"Packet",
... | Send an extension message and return the response. This is for advanced
use only.
@param request
String
@param requestData
byte[]
@return SftpMessage
@throws SshException
@throws SftpStatusException | [
"Send",
"an",
"extension",
"message",
"and",
"return",
"the",
"response",
".",
"This",
"is",
"for",
"advanced",
"use",
"only",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L380-L396 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.postWriteRequest | public UnsignedInteger32 postWriteRequest(byte[] handle, long position,
byte[] data, int off, int len) throws SftpStatusException,
SshException {
if ((data.length - off) < len) {
throw new IndexOutOfBoundsException("Incorrect data array size!");
}
try {
UnsignedInteger32 requestId = nextRequestId();... | java | public UnsignedInteger32 postWriteRequest(byte[] handle, long position,
byte[] data, int off, int len) throws SftpStatusException,
SshException {
if ((data.length - off) < len) {
throw new IndexOutOfBoundsException("Incorrect data array size!");
}
try {
UnsignedInteger32 requestId = nextRequestId();... | [
"public",
"UnsignedInteger32",
"postWriteRequest",
"(",
"byte",
"[",
"]",
"handle",
",",
"long",
"position",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"if",
"(",
"("... | Send a write request for an open file but do not wait for the response
from the server.
@param handle
@param position
@param data
@param off
@param len
@return UnsignedInteger32
@throws SshException | [
"Send",
"a",
"write",
"request",
"for",
"an",
"open",
"file",
"but",
"do",
"not",
"wait",
"for",
"the",
"response",
"from",
"the",
"server",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L534-L559 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.writeFile | public void writeFile(byte[] handle, UnsignedInteger64 offset, byte[] data,
int off, int len) throws SftpStatusException, SshException {
getOKRequestStatus(postWriteRequest(handle, offset.longValue(), data,
off, len));
} | java | public void writeFile(byte[] handle, UnsignedInteger64 offset, byte[] data,
int off, int len) throws SftpStatusException, SshException {
getOKRequestStatus(postWriteRequest(handle, offset.longValue(), data,
off, len));
} | [
"public",
"void",
"writeFile",
"(",
"byte",
"[",
"]",
"handle",
",",
"UnsignedInteger64",
"offset",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"getOKRequestStatus",
"("... | Write a block of data to an open file.
@param handle
the open file handle.
@param offset
the offset in the file to start writing
@param data
a buffer containing the data to write
@param off
the offset to start in the buffer
@param len
the length of data to write (setting to false will increase
file transfer but may mi... | [
"Write",
"a",
"block",
"of",
"data",
"to",
"an",
"open",
"file",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L577-L582 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.performSynchronousRead | public void performSynchronousRead(byte[] handle, int blocksize,
OutputStream out, FileTransferProgress progress, long position)
throws SftpStatusException, SshException,
TransferCancelledException {
if (Log.isDebugEnabled()) {
Log.debug(this, "Performing synchronous read postion="
+ position + " bl... | java | public void performSynchronousRead(byte[] handle, int blocksize,
OutputStream out, FileTransferProgress progress, long position)
throws SftpStatusException, SshException,
TransferCancelledException {
if (Log.isDebugEnabled()) {
Log.debug(this, "Performing synchronous read postion="
+ position + " bl... | [
"public",
"void",
"performSynchronousRead",
"(",
"byte",
"[",
"]",
"handle",
",",
"int",
"blocksize",
",",
"OutputStream",
"out",
",",
"FileTransferProgress",
"progress",
",",
"long",
"position",
")",
"throws",
"SftpStatusException",
",",
"SshException",
",",
"Tra... | Perform a synchronous read of a file from the remote file system. This
implementation waits for acknowledgement of every data packet before
requesting additional data.
@param handle
@param blocksize
@param out
@param progress
@param position
@throws SftpStatusException
@throws SshException
@throws TransferCancelledExc... | [
"Perform",
"a",
"synchronous",
"read",
"of",
"a",
"file",
"from",
"the",
"remote",
"file",
"system",
".",
"This",
"implementation",
"waits",
"for",
"acknowledgement",
"of",
"every",
"data",
"packet",
"before",
"requesting",
"additional",
"data",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1020-L1066 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.postReadRequest | public UnsignedInteger32 postReadRequest(byte[] handle, long offset, int len)
throws SftpStatusException, SshException {
try {
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_READ);
msg.writeInt(requestId.longValue());
msg.writeBinaryString(handle);
m... | java | public UnsignedInteger32 postReadRequest(byte[] handle, long offset, int len)
throws SftpStatusException, SshException {
try {
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_READ);
msg.writeInt(requestId.longValue());
msg.writeBinaryString(handle);
m... | [
"public",
"UnsignedInteger32",
"postReadRequest",
"(",
"byte",
"[",
"]",
"handle",
",",
"long",
"offset",
",",
"int",
"len",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"try",
"{",
"UnsignedInteger32",
"requestId",
"=",
"nextRequestId",
"(",
... | Post a read request to the server and return the request id; this is used
to optimize file downloads. In normal operation the files are transfered
by using a synchronous set of requests, however this slows the download
as the client has to wait for the servers response before sending another
request.
@param handle
@pa... | [
"Post",
"a",
"read",
"request",
"to",
"the",
"server",
"and",
"return",
"the",
"request",
"id",
";",
"this",
"is",
"used",
"to",
"optimize",
"file",
"downloads",
".",
"In",
"normal",
"operation",
"the",
"files",
"are",
"transfered",
"by",
"using",
"a",
"... | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1081-L1101 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.readFile | public int readFile(byte[] handle, UnsignedInteger64 offset, byte[] output,
int off, int len) throws SftpStatusException, SshException {
try {
if ((output.length - off) < len) {
throw new IndexOutOfBoundsException(
"Output array size is smaller than read length!");
}
UnsignedInteger32 requestI... | java | public int readFile(byte[] handle, UnsignedInteger64 offset, byte[] output,
int off, int len) throws SftpStatusException, SshException {
try {
if ((output.length - off) < len) {
throw new IndexOutOfBoundsException(
"Output array size is smaller than read length!");
}
UnsignedInteger32 requestI... | [
"public",
"int",
"readFile",
"(",
"byte",
"[",
"]",
"handle",
",",
"UnsignedInteger64",
"offset",
",",
"byte",
"[",
"]",
"output",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"try",
"{",
"if",
"("... | Read a block of data from an open file.
@param handle
the open file handle
@param offset
the offset to start reading in the file
@param output
a buffer to write the returned data to
@param off
the starting offset in the output buffer
@param len
the length of data to read
@return int
@throws SshException | [
"Read",
"a",
"block",
"of",
"data",
"from",
"an",
"open",
"file",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1119-L1165 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.createSymbolicLink | public void createSymbolicLink(String targetpath, String linkpath)
throws SftpStatusException, SshException {
if (version < 3) {
throw new SftpStatusException(
SftpStatusException.SSH_FX_OP_UNSUPPORTED,
"Symbolic links are not supported by the server SFTP version "
+ String.valueOf(version));
... | java | public void createSymbolicLink(String targetpath, String linkpath)
throws SftpStatusException, SshException {
if (version < 3) {
throw new SftpStatusException(
SftpStatusException.SSH_FX_OP_UNSUPPORTED,
"Symbolic links are not supported by the server SFTP version "
+ String.valueOf(version));
... | [
"public",
"void",
"createSymbolicLink",
"(",
"String",
"targetpath",
",",
"String",
"linkpath",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"if",
"(",
"version",
"<",
"3",
")",
"{",
"throw",
"new",
"SftpStatusException",
"(",
"SftpStatusExcepti... | Create a symbolic link.
@param targetpath
the symbolic link to create
@param linkpath
the path to which the symbolic link points
@throws SshException
if the remote SFTP version is < 3 an exception is thrown as
this feature is not supported by previous versions of the
protocol. | [
"Create",
"a",
"symbolic",
"link",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1207-L1233 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.getSymbolicLinkTarget | public String getSymbolicLinkTarget(String linkpath)
throws SftpStatusException, SshException {
if (version < 3) {
throw new SftpStatusException(
SftpStatusException.SSH_FX_OP_UNSUPPORTED,
"Symbolic links are not supported by the server SFTP version "
+ String.valueOf(version));
}
try {
... | java | public String getSymbolicLinkTarget(String linkpath)
throws SftpStatusException, SshException {
if (version < 3) {
throw new SftpStatusException(
SftpStatusException.SSH_FX_OP_UNSUPPORTED,
"Symbolic links are not supported by the server SFTP version "
+ String.valueOf(version));
}
try {
... | [
"public",
"String",
"getSymbolicLinkTarget",
"(",
"String",
"linkpath",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"if",
"(",
"version",
"<",
"3",
")",
"{",
"throw",
"new",
"SftpStatusException",
"(",
"SftpStatusException",
".",
"SSH_FX_OP_UNSUP... | Get the target path of a symbolic link.
@param linkpath
@return String
@throws SshException
if the remote SFTP version is < 3 an exception is thrown as
this feature is not supported by previous versions of the
protocol. | [
"Get",
"the",
"target",
"path",
"of",
"a",
"symbolic",
"link",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1245-L1272 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.getAbsolutePath | public String getAbsolutePath(String path) throws SftpStatusException,
SshException {
try {
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_REALPATH);
msg.writeInt(requestId.longValue());
msg.writeString(path, CHARSET_ENCODING);
sendMessage(msg);
... | java | public String getAbsolutePath(String path) throws SftpStatusException,
SshException {
try {
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_REALPATH);
msg.writeInt(requestId.longValue());
msg.writeString(path, CHARSET_ENCODING);
sendMessage(msg);
... | [
"public",
"String",
"getAbsolutePath",
"(",
"String",
"path",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"try",
"{",
"UnsignedInteger32",
"requestId",
"=",
"nextRequestId",
"(",
")",
";",
"Packet",
"msg",
"=",
"createPacket",
"(",
")",
";",
... | Get the absolute path of a file.
@param path
@return String
@throws SshException | [
"Get",
"the",
"absolute",
"path",
"of",
"a",
"file",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1292-L1333 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.recurseMakeDirectory | public void recurseMakeDirectory(String path) throws SftpStatusException,
SshException {
SftpFile file;
if (path.trim().length() > 0) {
try {
file = openDirectory(path);
file.close();
} catch (SshException ioe) {
int idx = 0;
do {
idx = path.indexOf('/', idx);
String tmp = (id... | java | public void recurseMakeDirectory(String path) throws SftpStatusException,
SshException {
SftpFile file;
if (path.trim().length() > 0) {
try {
file = openDirectory(path);
file.close();
} catch (SshException ioe) {
int idx = 0;
do {
idx = path.indexOf('/', idx);
String tmp = (id... | [
"public",
"void",
"recurseMakeDirectory",
"(",
"String",
"path",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"SftpFile",
"file",
";",
"if",
"(",
"path",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"try",
"{",
... | Recurse through a hierarchy of directories creating them as necessary.
@param path
@throws SftpStatusException
, SshException | [
"Recurse",
"through",
"a",
"hierarchy",
"of",
"directories",
"creating",
"them",
"as",
"necessary",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1488-L1515 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.openDirectory | public SftpFile openDirectory(String path) throws SftpStatusException,
SshException {
String absolutePath = getAbsolutePath(path);
SftpFileAttributes attrs = getAttributes(absolutePath);
if (!attrs.isDirectory()) {
throw new SftpStatusException(SftpStatusException.SSH_FX_FAILURE,
path + " is not a d... | java | public SftpFile openDirectory(String path) throws SftpStatusException,
SshException {
String absolutePath = getAbsolutePath(path);
SftpFileAttributes attrs = getAttributes(absolutePath);
if (!attrs.isDirectory()) {
throw new SftpStatusException(SftpStatusException.SSH_FX_FAILURE,
path + " is not a d... | [
"public",
"SftpFile",
"openDirectory",
"(",
"String",
"path",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"String",
"absolutePath",
"=",
"getAbsolutePath",
"(",
"path",
")",
";",
"SftpFileAttributes",
"attrs",
"=",
"getAttributes",
"(",
"absolute... | Open a directory.
@param path
@return sftpfile
@throws SftpStatusException
, SshException | [
"Open",
"a",
"directory",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1597-L1630 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.closeFile | public void closeFile(SftpFile file) throws SftpStatusException,
SshException {
if (file.getHandle() != null) {
closeHandle(file.getHandle());
EventServiceImplementation.getInstance().fireEvent(
(new Event(this, J2SSHEventCodes.EVENT_SFTP_FILE_CLOSED,
true)).addAttribute(
J2SSHEventCodes.... | java | public void closeFile(SftpFile file) throws SftpStatusException,
SshException {
if (file.getHandle() != null) {
closeHandle(file.getHandle());
EventServiceImplementation.getInstance().fireEvent(
(new Event(this, J2SSHEventCodes.EVENT_SFTP_FILE_CLOSED,
true)).addAttribute(
J2SSHEventCodes.... | [
"public",
"void",
"closeFile",
"(",
"SftpFile",
"file",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"if",
"(",
"file",
".",
"getHandle",
"(",
")",
"!=",
"null",
")",
"{",
"closeHandle",
"(",
"file",
".",
"getHandle",
"(",
")",
")",
";... | Close a file or directory.
@param file
@throws SftpStatusException
, SshException | [
"Close",
"a",
"file",
"or",
"directory",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1657-L1669 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.removeDirectory | public void removeDirectory(String path) throws SftpStatusException,
SshException {
try {
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_RMDIR);
msg.writeInt(requestId.longValue());
msg.writeString(path, CHARSET_ENCODING);
sendMessage(msg);
getO... | java | public void removeDirectory(String path) throws SftpStatusException,
SshException {
try {
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_RMDIR);
msg.writeInt(requestId.longValue());
msg.writeString(path, CHARSET_ENCODING);
sendMessage(msg);
getO... | [
"public",
"void",
"removeDirectory",
"(",
"String",
"path",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"try",
"{",
"UnsignedInteger32",
"requestId",
"=",
"nextRequestId",
"(",
")",
";",
"Packet",
"msg",
"=",
"createPacket",
"(",
")",
";",
... | Remove an empty directory.
@param path
@throws SftpStatusException
, SshException | [
"Remove",
"an",
"empty",
"directory",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1678-L1699 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.removeFile | public void removeFile(String filename) throws SftpStatusException,
SshException {
try {
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_REMOVE);
msg.writeInt(requestId.longValue());
msg.writeString(filename, CHARSET_ENCODING);
sendMessage(msg);
... | java | public void removeFile(String filename) throws SftpStatusException,
SshException {
try {
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_REMOVE);
msg.writeInt(requestId.longValue());
msg.writeString(filename, CHARSET_ENCODING);
sendMessage(msg);
... | [
"public",
"void",
"removeFile",
"(",
"String",
"filename",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"try",
"{",
"UnsignedInteger32",
"requestId",
"=",
"nextRequestId",
"(",
")",
";",
"Packet",
"msg",
"=",
"createPacket",
"(",
")",
";",
"... | Remove a file.
@param filename
@throws SftpStatusException
, SshException | [
"Remove",
"a",
"file",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1708-L1732 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.renameFile | public void renameFile(String oldpath, String newpath)
throws SftpStatusException, SshException {
if (version < 2) {
throw new SftpStatusException(
SftpStatusException.SSH_FX_OP_UNSUPPORTED,
"Renaming files is not supported by the server SFTP version "
+ String.valueOf(version));
}
try {
... | java | public void renameFile(String oldpath, String newpath)
throws SftpStatusException, SshException {
if (version < 2) {
throw new SftpStatusException(
SftpStatusException.SSH_FX_OP_UNSUPPORTED,
"Renaming files is not supported by the server SFTP version "
+ String.valueOf(version));
}
try {
... | [
"public",
"void",
"renameFile",
"(",
"String",
"oldpath",
",",
"String",
"newpath",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"if",
"(",
"version",
"<",
"2",
")",
"{",
"throw",
"new",
"SftpStatusException",
"(",
"SftpStatusException",
".",
... | Rename an existing file.
@param oldpath
@param newpath
@throws SftpStatusException
, SshException | [
"Rename",
"an",
"existing",
"file",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1742-L1778 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.getAttributes | public SftpFileAttributes getAttributes(SftpFile file)
throws SftpStatusException, SshException {
try {
if (file.getHandle() == null) {
return getAttributes(file.getAbsolutePath());
}
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_FSTAT);
msg.wr... | java | public SftpFileAttributes getAttributes(SftpFile file)
throws SftpStatusException, SshException {
try {
if (file.getHandle() == null) {
return getAttributes(file.getAbsolutePath());
}
UnsignedInteger32 requestId = nextRequestId();
Packet msg = createPacket();
msg.write(SSH_FXP_FSTAT);
msg.wr... | [
"public",
"SftpFileAttributes",
"getAttributes",
"(",
"SftpFile",
"file",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"try",
"{",
"if",
"(",
"file",
".",
"getHandle",
"(",
")",
"==",
"null",
")",
"{",
"return",
"getAttributes",
"(",
"file",... | Get the attributes of a file.
@param file
@return SftpFileAttributes
@throws SftpStatusException
, SshException | [
"Get",
"the",
"attributes",
"of",
"a",
"file",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1874-L1906 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java | SftpSubsystemChannel.makeDirectory | public void makeDirectory(String path) throws SftpStatusException,
SshException {
makeDirectory(path, new SftpFileAttributes(this,
SftpFileAttributes.SSH_FILEXFER_TYPE_DIRECTORY));
} | java | public void makeDirectory(String path) throws SftpStatusException,
SshException {
makeDirectory(path, new SftpFileAttributes(this,
SftpFileAttributes.SSH_FILEXFER_TYPE_DIRECTORY));
} | [
"public",
"void",
"makeDirectory",
"(",
"String",
"path",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"makeDirectory",
"(",
"path",
",",
"new",
"SftpFileAttributes",
"(",
"this",
",",
"SftpFileAttributes",
".",
"SSH_FILEXFER_TYPE_DIRECTORY",
")",
... | Make a directory. If the directory exists this method will throw an
exception.
@param path
@throws SftpStatusException
, SshException | [
"Make",
"a",
"directory",
".",
"If",
"the",
"directory",
"exists",
"this",
"method",
"will",
"throw",
"an",
"exception",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1916-L1920 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/server/ServerAuthenticatorNone.java | ServerAuthenticatorNone.startSession | public ServerAuthenticator startSession(Socket s)
throws IOException{
PushbackInputStream in = new PushbackInputStream(s.getInputStream());
OutputStream out = s.getOutputStream();
int version = in.read();
if(version == 5){
if(!selectSocks5Authentication(in... | java | public ServerAuthenticator startSession(Socket s)
throws IOException{
PushbackInputStream in = new PushbackInputStream(s.getInputStream());
OutputStream out = s.getOutputStream();
int version = in.read();
if(version == 5){
if(!selectSocks5Authentication(in... | [
"public",
"ServerAuthenticator",
"startSession",
"(",
"Socket",
"s",
")",
"throws",
"IOException",
"{",
"PushbackInputStream",
"in",
"=",
"new",
"PushbackInputStream",
"(",
"s",
".",
"getInputStream",
"(",
")",
")",
";",
"OutputStream",
"out",
"=",
"s",
".",
"... | Grants access to everyone.Removes authentication related bytes from
the stream, when a SOCKS5 connection is being made, selects an
authentication NONE. | [
"Grants",
"access",
"to",
"everyone",
".",
"Removes",
"authentication",
"related",
"bytes",
"from",
"the",
"stream",
"when",
"a",
"SOCKS5",
"connection",
"is",
"being",
"made",
"selects",
"an",
"authentication",
"NONE",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/server/ServerAuthenticatorNone.java#L89-L107 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/UDPRelayServer.java | UDPRelayServer.start | public void start() throws IOException{
remote_sock.setSoTimeout(iddleTimeout);
client_sock.setSoTimeout(iddleTimeout);
log("Starting UDP relay server on "+relayIP+":"+relayPort);
log("Remote socket "+remote_sock.getLocalAddress()+":"+
remote_sock.getLocalPort())... | java | public void start() throws IOException{
remote_sock.setSoTimeout(iddleTimeout);
client_sock.setSoTimeout(iddleTimeout);
log("Starting UDP relay server on "+relayIP+":"+relayPort);
log("Remote socket "+remote_sock.getLocalAddress()+":"+
remote_sock.getLocalPort())... | [
"public",
"void",
"start",
"(",
")",
"throws",
"IOException",
"{",
"remote_sock",
".",
"setSoTimeout",
"(",
"iddleTimeout",
")",
";",
"client_sock",
".",
"setSoTimeout",
"(",
"iddleTimeout",
")",
";",
"log",
"(",
"\"Starting UDP relay server on \"",
"+",
"relayIP"... | Starts udp relay server.
Spawns two threads of execution and returns. | [
"Starts",
"udp",
"relay",
"server",
".",
"Spawns",
"two",
"threads",
"of",
"execution",
"and",
"returns",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/UDPRelayServer.java#L135-L150 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java | Ssh2Session.startSubsystem | public boolean startSubsystem(String subsystem) throws SshException {
ByteArrayWriter request = new ByteArrayWriter();
try {
request.writeString(subsystem);
boolean success = sendRequest("subsystem", true,
request.toByteArray());
if (success) {
EventServiceImplementation.getInstance().fireEvent(... | java | public boolean startSubsystem(String subsystem) throws SshException {
ByteArrayWriter request = new ByteArrayWriter();
try {
request.writeString(subsystem);
boolean success = sendRequest("subsystem", true,
request.toByteArray());
if (success) {
EventServiceImplementation.getInstance().fireEvent(... | [
"public",
"boolean",
"startSubsystem",
"(",
"String",
"subsystem",
")",
"throws",
"SshException",
"{",
"ByteArrayWriter",
"request",
"=",
"new",
"ByteArrayWriter",
"(",
")",
";",
"try",
"{",
"request",
".",
"writeString",
"(",
"subsystem",
")",
";",
"boolean",
... | SSH2 supports special subsystems that are identified by a name rather
than a command string, an example of an SSH2 subsystem is SFTP.
@param subsystem
the name of the subsystem, for example "sftp"
@return <code>true</code> if the subsystem was started, otherwise
<code>false</code>
@throws SshException | [
"SSH2",
"supports",
"special",
"subsystems",
"that",
"are",
"identified",
"by",
"a",
"name",
"rather",
"than",
"a",
"command",
"string",
"an",
"example",
"of",
"an",
"SSH2",
"subsystem",
"is",
"SFTP",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java#L227-L264 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java | Ssh2Session.requestX11Forwarding | boolean requestX11Forwarding(boolean singleconnection, String protocol,
String cookie, int screen) throws SshException {
ByteArrayWriter request = new ByteArrayWriter();
try {
request.writeBoolean(singleconnection);
request.writeString(protocol);
request.writeString(cookie);
request.writeInt(screen)... | java | boolean requestX11Forwarding(boolean singleconnection, String protocol,
String cookie, int screen) throws SshException {
ByteArrayWriter request = new ByteArrayWriter();
try {
request.writeBoolean(singleconnection);
request.writeString(protocol);
request.writeString(cookie);
request.writeInt(screen)... | [
"boolean",
"requestX11Forwarding",
"(",
"boolean",
"singleconnection",
",",
"String",
"protocol",
",",
"String",
"cookie",
",",
"int",
"screen",
")",
"throws",
"SshException",
"{",
"ByteArrayWriter",
"request",
"=",
"new",
"ByteArrayWriter",
"(",
")",
";",
"try",
... | Send a request for X Forwarding.
@param singleconnection
@param protocol
@param cookie
@param display
@return boolean
@throws SshException | [
"Send",
"a",
"request",
"for",
"X",
"Forwarding",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java#L276-L294 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java | Ssh2Session.setEnvironmentVariable | public boolean setEnvironmentVariable(String name, String value)
throws SshException {
ByteArrayWriter request = new ByteArrayWriter();
try {
request.writeString(name);
request.writeString(value);
return sendRequest("env", true, request.toByteArray());
} catch (IOException ex) {
throw new SshExcep... | java | public boolean setEnvironmentVariable(String name, String value)
throws SshException {
ByteArrayWriter request = new ByteArrayWriter();
try {
request.writeString(name);
request.writeString(value);
return sendRequest("env", true, request.toByteArray());
} catch (IOException ex) {
throw new SshExcep... | [
"public",
"boolean",
"setEnvironmentVariable",
"(",
"String",
"name",
",",
"String",
"value",
")",
"throws",
"SshException",
"{",
"ByteArrayWriter",
"request",
"=",
"new",
"ByteArrayWriter",
"(",
")",
";",
"try",
"{",
"request",
".",
"writeString",
"(",
"name",
... | The SSH2 session supports the setting of environments variables however
in our experiance no server to date allows unconditional setting of
variables. This method should be called before the command is started. | [
"The",
"SSH2",
"session",
"supports",
"the",
"setting",
"of",
"environments",
"variables",
"however",
"in",
"our",
"experiance",
"no",
"server",
"to",
"date",
"allows",
"unconditional",
"setting",
"of",
"variables",
".",
"This",
"method",
"should",
"be",
"called... | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java#L301-L317 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java | Ssh2Session.channelRequest | protected void channelRequest(String requesttype, boolean wantreply,
byte[] requestdata) throws SshException {
try {
if (requesttype.equals("exit-status")) {
if (requestdata != null) {
exitcode = (int) ByteArrayReader.readInt(requestdata, 0);
}
}
if (requesttype.equals("exit-signal")) {
... | java | protected void channelRequest(String requesttype, boolean wantreply,
byte[] requestdata) throws SshException {
try {
if (requesttype.equals("exit-status")) {
if (requestdata != null) {
exitcode = (int) ByteArrayReader.readInt(requestdata, 0);
}
}
if (requesttype.equals("exit-signal")) {
... | [
"protected",
"void",
"channelRequest",
"(",
"String",
"requesttype",
",",
"boolean",
"wantreply",
",",
"byte",
"[",
"]",
"requestdata",
")",
"throws",
"SshException",
"{",
"try",
"{",
"if",
"(",
"requesttype",
".",
"equals",
"(",
"\"exit-status\"",
")",
")",
... | This overidden method handles the "exit-status", "exit-signal" and
"xon-xoff" channel requests. | [
"This",
"overidden",
"method",
"handles",
"the",
"exit",
"-",
"status",
"exit",
"-",
"signal",
"and",
"xon",
"-",
"xoff",
"channel",
"requests",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java#L403-L441 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.startLocalForwarding | public void startLocalForwarding(String addressToBind, int portToBind,
String hostToConnect, int portToConnect) throws SshException {
String key = generateKey(addressToBind, portToBind);
SocketListener listener = new SocketListener(addressToBind, portToBind,
hostToConnect, portToConnect);
listener.start(... | java | public void startLocalForwarding(String addressToBind, int portToBind,
String hostToConnect, int portToConnect) throws SshException {
String key = generateKey(addressToBind, portToBind);
SocketListener listener = new SocketListener(addressToBind, portToBind,
hostToConnect, portToConnect);
listener.start(... | [
"public",
"void",
"startLocalForwarding",
"(",
"String",
"addressToBind",
",",
"int",
"portToBind",
",",
"String",
"hostToConnect",
",",
"int",
"portToConnect",
")",
"throws",
"SshException",
"{",
"String",
"key",
"=",
"generateKey",
"(",
"addressToBind",
",",
"po... | Start's a local listening socket and forwards any connections made to the
to the remote side.
@param addressToBind
the listening address
@param portToBind
the listening port
@param hostToConnect
the host to connect on the remote side
@param portToConnect
the port to connect on the remote side
@throws IOException | [
"Start",
"s",
"a",
"local",
"listening",
"socket",
"and",
"forwards",
"any",
"connections",
"made",
"to",
"the",
"to",
"the",
"remote",
"side",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L315-L348 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.getRemoteForwardings | public String[] getRemoteForwardings() {
String[] r = new String[remoteforwardings.size()
- (remoteforwardings.containsKey(X11_KEY) ? 1 : 0)];
int index = 0;
for (Enumeration<String> e = remoteforwardings.keys(); e
.hasMoreElements();) {
String key = e.nextElement();
if (!key.equals(X11_KEY))
r... | java | public String[] getRemoteForwardings() {
String[] r = new String[remoteforwardings.size()
- (remoteforwardings.containsKey(X11_KEY) ? 1 : 0)];
int index = 0;
for (Enumeration<String> e = remoteforwardings.keys(); e
.hasMoreElements();) {
String key = e.nextElement();
if (!key.equals(X11_KEY))
r... | [
"public",
"String",
"[",
"]",
"getRemoteForwardings",
"(",
")",
"{",
"String",
"[",
"]",
"r",
"=",
"new",
"String",
"[",
"remoteforwardings",
".",
"size",
"(",
")",
"-",
"(",
"remoteforwardings",
".",
"containsKey",
"(",
"X11_KEY",
")",
"?",
"1",
":",
... | Returns the currently active remote forwarding listeners.
@return String[] | [
"Returns",
"the",
"currently",
"active",
"remote",
"forwarding",
"listeners",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L425-L437 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.getLocalForwardings | public String[] getLocalForwardings() {
String[] r = new String[socketlisteners.size()];
int index = 0;
for (Enumeration<String> e = socketlisteners.keys(); e
.hasMoreElements();) {
r[index++] = e.nextElement();
}
return r;
} | java | public String[] getLocalForwardings() {
String[] r = new String[socketlisteners.size()];
int index = 0;
for (Enumeration<String> e = socketlisteners.keys(); e
.hasMoreElements();) {
r[index++] = e.nextElement();
}
return r;
} | [
"public",
"String",
"[",
"]",
"getLocalForwardings",
"(",
")",
"{",
"String",
"[",
"]",
"r",
"=",
"new",
"String",
"[",
"socketlisteners",
".",
"size",
"(",
")",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"Enumeration",
"<",
"String",
">",
... | Return the currently active local forwarding listeners.
@return String[] | [
"Return",
"the",
"currently",
"active",
"local",
"forwarding",
"listeners",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L444-L454 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.getRemoteForwardingTunnels | public ActiveTunnel[] getRemoteForwardingTunnels() throws IOException {
Vector<ActiveTunnel> v = new Vector<ActiveTunnel>();
String[] remoteForwardings = getRemoteForwardings();
for (int i = 0; i < remoteForwardings.length; i++) {
ActiveTunnel[] tmp = getRemoteForwardingTunnels(remoteForwardings[i]);
for (i... | java | public ActiveTunnel[] getRemoteForwardingTunnels() throws IOException {
Vector<ActiveTunnel> v = new Vector<ActiveTunnel>();
String[] remoteForwardings = getRemoteForwardings();
for (int i = 0; i < remoteForwardings.length; i++) {
ActiveTunnel[] tmp = getRemoteForwardingTunnels(remoteForwardings[i]);
for (i... | [
"public",
"ActiveTunnel",
"[",
"]",
"getRemoteForwardingTunnels",
"(",
")",
"throws",
"IOException",
"{",
"Vector",
"<",
"ActiveTunnel",
">",
"v",
"=",
"new",
"Vector",
"<",
"ActiveTunnel",
">",
"(",
")",
";",
"String",
"[",
"]",
"remoteForwardings",
"=",
"g... | Get all the active remote forwarding tunnels
@return
@throws IOException | [
"Get",
"all",
"the",
"active",
"remote",
"forwarding",
"tunnels"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L500-L511 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.getLocalForwardingTunnels | public ActiveTunnel[] getLocalForwardingTunnels() throws IOException {
Vector<ActiveTunnel> v = new Vector<ActiveTunnel>();
String[] localForwardings = getLocalForwardings();
for (int i = 0; i < localForwardings.length; i++) {
ActiveTunnel[] tmp = getLocalForwardingTunnels(localForwardings[i]);
for (int x =... | java | public ActiveTunnel[] getLocalForwardingTunnels() throws IOException {
Vector<ActiveTunnel> v = new Vector<ActiveTunnel>();
String[] localForwardings = getLocalForwardings();
for (int i = 0; i < localForwardings.length; i++) {
ActiveTunnel[] tmp = getLocalForwardingTunnels(localForwardings[i]);
for (int x =... | [
"public",
"ActiveTunnel",
"[",
"]",
"getLocalForwardingTunnels",
"(",
")",
"throws",
"IOException",
"{",
"Vector",
"<",
"ActiveTunnel",
">",
"v",
"=",
"new",
"Vector",
"<",
"ActiveTunnel",
">",
"(",
")",
";",
"String",
"[",
"]",
"localForwardings",
"=",
"get... | Get all the active local forwarding tunnels
@return
@throws IOException | [
"Get",
"all",
"the",
"active",
"local",
"forwarding",
"tunnels"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L519-L530 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.getX11ForwardingTunnels | public ActiveTunnel[] getX11ForwardingTunnels() throws IOException {
if (incomingtunnels.containsKey(X11_KEY)) {
Vector<ActiveTunnel> v = incomingtunnels.get(X11_KEY);
ActiveTunnel[] t = new ActiveTunnel[v.size()];
v.copyInto(t);
return t;
}
return new ActiveTunnel[] {};
} | java | public ActiveTunnel[] getX11ForwardingTunnels() throws IOException {
if (incomingtunnels.containsKey(X11_KEY)) {
Vector<ActiveTunnel> v = incomingtunnels.get(X11_KEY);
ActiveTunnel[] t = new ActiveTunnel[v.size()];
v.copyInto(t);
return t;
}
return new ActiveTunnel[] {};
} | [
"public",
"ActiveTunnel",
"[",
"]",
"getX11ForwardingTunnels",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"incomingtunnels",
".",
"containsKey",
"(",
"X11_KEY",
")",
")",
"{",
"Vector",
"<",
"ActiveTunnel",
">",
"v",
"=",
"incomingtunnels",
".",
"get",... | Get the active X11 forwarding channels.
@return ActiveTunnel[]
@throws IOException | [
"Get",
"the",
"active",
"X11",
"forwarding",
"channels",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L588-L597 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.requestRemoteForwarding | public boolean requestRemoteForwarding(String addressToBind,
int portToBind, String hostToConnect, int portToConnect)
throws SshException {
if (ssh.requestRemoteForwarding(addressToBind, portToBind,
hostToConnect, portToConnect, forwardinglistener)) {
String key = generateKey(addressToBind, portToBind);
... | java | public boolean requestRemoteForwarding(String addressToBind,
int portToBind, String hostToConnect, int portToConnect)
throws SshException {
if (ssh.requestRemoteForwarding(addressToBind, portToBind,
hostToConnect, portToConnect, forwardinglistener)) {
String key = generateKey(addressToBind, portToBind);
... | [
"public",
"boolean",
"requestRemoteForwarding",
"(",
"String",
"addressToBind",
",",
"int",
"portToBind",
",",
"String",
"hostToConnect",
",",
"int",
"portToConnect",
")",
"throws",
"SshException",
"{",
"if",
"(",
"ssh",
".",
"requestRemoteForwarding",
"(",
"address... | Requests that the remote side start listening for socket connections so
that they may be forwarded to to the local destination.
@param addressToBind
the listening address on the remote server
@param portToBind
the listening port on the remote server
@param hostToConnect
the host to connect on the local side
@param por... | [
"Requests",
"that",
"the",
"remote",
"side",
"start",
"listening",
"for",
"socket",
"connections",
"so",
"that",
"they",
"may",
"be",
"forwarded",
"to",
"to",
"the",
"local",
"destination",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L614-L635 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.cancelRemoteForwarding | public void cancelRemoteForwarding(String bindAddress, int bindPort,
boolean killActiveTunnels) throws SshException {
String key = generateKey(bindAddress, bindPort);
boolean killedTunnels = false;
if (killActiveTunnels) {
try {
ActiveTunnel[] tunnels = getRemoteForwardingTunnels(
bindAddress, b... | java | public void cancelRemoteForwarding(String bindAddress, int bindPort,
boolean killActiveTunnels) throws SshException {
String key = generateKey(bindAddress, bindPort);
boolean killedTunnels = false;
if (killActiveTunnels) {
try {
ActiveTunnel[] tunnels = getRemoteForwardingTunnels(
bindAddress, b... | [
"public",
"void",
"cancelRemoteForwarding",
"(",
"String",
"bindAddress",
",",
"int",
"bindPort",
",",
"boolean",
"killActiveTunnels",
")",
"throws",
"SshException",
"{",
"String",
"key",
"=",
"generateKey",
"(",
"bindAddress",
",",
"bindPort",
")",
";",
"boolean"... | Requests that the remote side stop listening for socket connections.
Please note that this feature is not available on SSH1 connections. The
only way to stop the server from listening is to disconnect the
connection.
@param bindAddress
the listening address on the remote side
@param bindPort
the listening port on the ... | [
"Requests",
"that",
"the",
"remote",
"side",
"stop",
"listening",
"for",
"socket",
"connections",
".",
"Please",
"note",
"that",
"this",
"feature",
"is",
"not",
"available",
"on",
"SSH1",
"connections",
".",
"The",
"only",
"way",
"to",
"stop",
"the",
"server... | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L890-L952 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.cancelAllRemoteForwarding | public synchronized void cancelAllRemoteForwarding(boolean killActiveTunnels)
throws SshException {
if (remoteforwardings == null) {
return;
}
for (Enumeration<String> e = remoteforwardings.keys(); e
.hasMoreElements();) {
String host = (String) e.nextElement();
if (host == null)
return;
... | java | public synchronized void cancelAllRemoteForwarding(boolean killActiveTunnels)
throws SshException {
if (remoteforwardings == null) {
return;
}
for (Enumeration<String> e = remoteforwardings.keys(); e
.hasMoreElements();) {
String host = (String) e.nextElement();
if (host == null)
return;
... | [
"public",
"synchronized",
"void",
"cancelAllRemoteForwarding",
"(",
"boolean",
"killActiveTunnels",
")",
"throws",
"SshException",
"{",
"if",
"(",
"remoteforwardings",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"Enumeration",
"<",
"String",
">",
"e"... | Stop all remote forwarding.
@param killActiveTunnels
Should any active tunnels be closed.
@throws SshException | [
"Stop",
"all",
"remote",
"forwarding",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L970-L999 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.stopAllLocalForwarding | public synchronized void stopAllLocalForwarding(boolean killActiveTunnels)
throws SshException {
for (Enumeration<String> e = socketlisteners.keys(); e
.hasMoreElements();) {
stopLocalForwarding((String) e.nextElement(), killActiveTunnels);
}
} | java | public synchronized void stopAllLocalForwarding(boolean killActiveTunnels)
throws SshException {
for (Enumeration<String> e = socketlisteners.keys(); e
.hasMoreElements();) {
stopLocalForwarding((String) e.nextElement(), killActiveTunnels);
}
} | [
"public",
"synchronized",
"void",
"stopAllLocalForwarding",
"(",
"boolean",
"killActiveTunnels",
")",
"throws",
"SshException",
"{",
"for",
"(",
"Enumeration",
"<",
"String",
">",
"e",
"=",
"socketlisteners",
".",
"keys",
"(",
")",
";",
"e",
".",
"hasMoreElement... | Stop all local forwarding
@param killActiveTunnels
should any active tunnels be closed | [
"Stop",
"all",
"local",
"forwarding"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L1036-L1042 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.stopLocalForwarding | public synchronized void stopLocalForwarding(String bindAddress,
int bindPort, boolean killActiveTunnels) throws SshException {
String key = generateKey(bindAddress, bindPort);
stopLocalForwarding(key, killActiveTunnels);
} | java | public synchronized void stopLocalForwarding(String bindAddress,
int bindPort, boolean killActiveTunnels) throws SshException {
String key = generateKey(bindAddress, bindPort);
stopLocalForwarding(key, killActiveTunnels);
} | [
"public",
"synchronized",
"void",
"stopLocalForwarding",
"(",
"String",
"bindAddress",
",",
"int",
"bindPort",
",",
"boolean",
"killActiveTunnels",
")",
"throws",
"SshException",
"{",
"String",
"key",
"=",
"generateKey",
"(",
"bindAddress",
",",
"bindPort",
")",
"... | Stops a local listening socket from accepting connections.
@param bindAddress
the listening address
@param bindPort
the listening port
@param killActiveTunnels
should any active tunnels be closed. | [
"Stops",
"a",
"local",
"listening",
"socket",
"from",
"accepting",
"connections",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L1067-L1071 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java | ForwardingClient.stopLocalForwarding | public synchronized void stopLocalForwarding(String key,
boolean killActiveTunnels) throws SshException {
if (key == null)
return;
boolean killedTunnels = false;
if (killActiveTunnels) {
try {
ActiveTunnel[] tunnels = getLocalForwardingTunnels(key);
if (tunnels != null) {
for (int i = 0;... | java | public synchronized void stopLocalForwarding(String key,
boolean killActiveTunnels) throws SshException {
if (key == null)
return;
boolean killedTunnels = false;
if (killActiveTunnels) {
try {
ActiveTunnel[] tunnels = getLocalForwardingTunnels(key);
if (tunnels != null) {
for (int i = 0;... | [
"public",
"synchronized",
"void",
"stopLocalForwarding",
"(",
"String",
"key",
",",
"boolean",
"killActiveTunnels",
")",
"throws",
"SshException",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"return",
";",
"boolean",
"killedTunnels",
"=",
"false",
";",
"if",
"("... | Stop a local listening socket from accepting connections.
@param key
the bound address and port in the format "127.0.0.1:8080"
@param killActiveTunnels
should any active tunnels be closed.
@throws SshException | [
"Stop",
"a",
"local",
"listening",
"socket",
"from",
"accepting",
"connections",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L1082-L1142 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/Ssh2DsaPublicKey.java | Ssh2DsaPublicKey.verifySignature | public boolean verifySignature(byte[] signature, byte[] data)
throws SshException {
ByteArrayReader bar = new ByteArrayReader(signature);
try {
if (signature.length != 40 // 160 bits
&& signature.length != 56 // 224 bits
&& signature.length != 64) { // 256 bits
byte[] sig = bar.readBinaryStr... | java | public boolean verifySignature(byte[] signature, byte[] data)
throws SshException {
ByteArrayReader bar = new ByteArrayReader(signature);
try {
if (signature.length != 40 // 160 bits
&& signature.length != 56 // 224 bits
&& signature.length != 64) { // 256 bits
byte[] sig = bar.readBinaryStr... | [
"public",
"boolean",
"verifySignature",
"(",
"byte",
"[",
"]",
"signature",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"SshException",
"{",
"ByteArrayReader",
"bar",
"=",
"new",
"ByteArrayReader",
"(",
"signature",
")",
";",
"try",
"{",
"if",
"(",
"sign... | Verify the signature.
@param signature
byte[]
@param data
byte[]
@return <code>true</code> if the signature was produced by the
corresponding private key that owns this public key, otherwise
<code>false</code>.
@throws SshException
@todo Implement this com.sshtools.ssh.SshPublicKey method | [
"Verify",
"the",
"signature",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/jce/Ssh2DsaPublicKey.java#L196-L274 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/components/ComponentManager.java | ComponentManager.getInstance | public static ComponentManager getInstance() throws SshException {
synchronized (ComponentManager.class) {
if (instance == null) {
instance = new JCEComponentManager();
instance.init();
}
return instance;
}
} | java | public static ComponentManager getInstance() throws SshException {
synchronized (ComponentManager.class) {
if (instance == null) {
instance = new JCEComponentManager();
instance.init();
}
return instance;
}
} | [
"public",
"static",
"ComponentManager",
"getInstance",
"(",
")",
"throws",
"SshException",
"{",
"synchronized",
"(",
"ComponentManager",
".",
"class",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"instance",
"=",
"new",
"JCEComponentManager",
"(",
... | Get the installed component manager. Don't want to initialize this at
class load time, so use a singleton instead. Initialized on the first
call to getInstance.
@return ComponentManager
@throws SshException | [
"Get",
"the",
"installed",
"component",
"manager",
".",
"Don",
"t",
"want",
"to",
"initialize",
"this",
"at",
"class",
"load",
"time",
"so",
"use",
"a",
"singleton",
"instead",
".",
"Initialized",
"on",
"the",
"first",
"call",
"to",
"getInstance",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/ComponentManager.java#L90-L98 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2PasswordAuthentication.java | Ssh2PasswordAuthentication.authenticate | public void authenticate(AuthenticationProtocol authentication,
String servicename) throws SshException, AuthenticationResult {
try {
if (getUsername() == null || getPassword() == null) {
throw new SshException("Username or password not set!",
SshException.BAD_API_USAGE);
}
if (passwordChangeR... | java | public void authenticate(AuthenticationProtocol authentication,
String servicename) throws SshException, AuthenticationResult {
try {
if (getUsername() == null || getPassword() == null) {
throw new SshException("Username or password not set!",
SshException.BAD_API_USAGE);
}
if (passwordChangeR... | [
"public",
"void",
"authenticate",
"(",
"AuthenticationProtocol",
"authentication",
",",
"String",
"servicename",
")",
"throws",
"SshException",
",",
"AuthenticationResult",
"{",
"try",
"{",
"if",
"(",
"getUsername",
"(",
")",
"==",
"null",
"||",
"getPassword",
"("... | Implementation of the authentication method.
@param authentication
@param servicename
@throws IOException
@throws AuthenticationResult | [
"Implementation",
"of",
"the",
"authentication",
"method",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2PasswordAuthentication.java#L117-L165 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/scp/ScpClient.java | ScpClient.put | public void put(String localFileRegExp, String remoteFile,
boolean recursive, FileTransferProgress progress)
throws SshException, ChannelOpenException {
GlobRegExpMatching globMatcher = new GlobRegExpMatching();
String parentDir;
int fileSeparatorIndex;
parentDir = cwd.getAbsolutePath();
String relative... | java | public void put(String localFileRegExp, String remoteFile,
boolean recursive, FileTransferProgress progress)
throws SshException, ChannelOpenException {
GlobRegExpMatching globMatcher = new GlobRegExpMatching();
String parentDir;
int fileSeparatorIndex;
parentDir = cwd.getAbsolutePath();
String relative... | [
"public",
"void",
"put",
"(",
"String",
"localFileRegExp",
",",
"String",
"remoteFile",
",",
"boolean",
"recursive",
",",
"FileTransferProgress",
"progress",
")",
"throws",
"SshException",
",",
"ChannelOpenException",
"{",
"GlobRegExpMatching",
"globMatcher",
"=",
"ne... | pattern matches the files in the local directory using "local" as a glob
Regular Expression. For the matching file array put is called to copy the
file to the remote directory.
@param localFileRegExp
@param remoteFile
@param recursive
@param progress
@throws SshException
@throws ChannelOpenException | [
"pattern",
"matches",
"the",
"files",
"in",
"the",
"local",
"directory",
"using",
"local",
"as",
"a",
"glob",
"Regular",
"Expression",
".",
"For",
"the",
"matching",
"file",
"array",
"put",
"is",
"called",
"to",
"copy",
"the",
"file",
"to",
"the",
"remote"... | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/scp/ScpClient.java#L214-L264 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java | Ssh2Channel.open | protected void open(int remoteid, long remotewindow, int remotepacket)
throws IOException {
this.remoteid = remoteid;
this.remotewindow = new DataWindow(remotewindow, remotepacket);
this.state = CHANNEL_OPEN;
synchronized (listeners) {
for (Enumeration<ChannelEventListener> e = listeners.elements(); e
... | java | protected void open(int remoteid, long remotewindow, int remotepacket)
throws IOException {
this.remoteid = remoteid;
this.remotewindow = new DataWindow(remotewindow, remotepacket);
this.state = CHANNEL_OPEN;
synchronized (listeners) {
for (Enumeration<ChannelEventListener> e = listeners.elements(); e
... | [
"protected",
"void",
"open",
"(",
"int",
"remoteid",
",",
"long",
"remotewindow",
",",
"int",
"remotepacket",
")",
"throws",
"IOException",
"{",
"this",
".",
"remoteid",
"=",
"remoteid",
";",
"this",
".",
"remotewindow",
"=",
"new",
"DataWindow",
"(",
"remot... | Called once an SSH_MSG_CHANNEL_OPEN_CONFIRMATION has been sent.
@param remoteid
@param remotewindow
@param remotepacket
@throws IOException | [
"Called",
"once",
"an",
"SSH_MSG_CHANNEL_OPEN_CONFIRMATION",
"has",
"been",
"sent",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java#L307-L320 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java | Ssh2Channel.open | protected void open(int remoteid, long remotewindow, int remotepacket,
byte[] responsedata) throws IOException {
open(remoteid, remotewindow, remotepacket);
} | java | protected void open(int remoteid, long remotewindow, int remotepacket,
byte[] responsedata) throws IOException {
open(remoteid, remotewindow, remotepacket);
} | [
"protected",
"void",
"open",
"(",
"int",
"remoteid",
",",
"long",
"remotewindow",
",",
"int",
"remotepacket",
",",
"byte",
"[",
"]",
"responsedata",
")",
"throws",
"IOException",
"{",
"open",
"(",
"remoteid",
",",
"remotewindow",
",",
"remotepacket",
")",
";... | Once a SSH_MSG_CHANNEL_OPEN_CONFIRMATION message is received the
framework calls this method to complete the channel open operation.
@param remoteid
the senders id
@param remotewindow
the initial window space available for sending data
@param remotepacket
the maximum packet size available for sending data
@param respo... | [
"Once",
"a",
"SSH_MSG_CHANNEL_OPEN_CONFIRMATION",
"message",
"is",
"received",
"the",
"framework",
"calls",
"this",
"method",
"to",
"complete",
"the",
"channel",
"open",
"operation",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java#L337-L342 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java | Ssh2Channel.close | public void close() {
boolean performClose = false;
;
synchronized (this) {
if (!closing && state == CHANNEL_OPEN) {
performClose = closing = true;
}
}
if (performClose) {
synchronized (listeners) {
for (Enumeration<ChannelEventListener> e = listeners.elements(); e
.hasMoreElements(... | java | public void close() {
boolean performClose = false;
;
synchronized (this) {
if (!closing && state == CHANNEL_OPEN) {
performClose = closing = true;
}
}
if (performClose) {
synchronized (listeners) {
for (Enumeration<ChannelEventListener> e = listeners.elements(); e
.hasMoreElements(... | [
"public",
"void",
"close",
"(",
")",
"{",
"boolean",
"performClose",
"=",
"false",
";",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"!",
"closing",
"&&",
"state",
"==",
"CHANNEL_OPEN",
")",
"{",
"performClose",
"=",
"closing",
"=",
"true",
"... | Closes the channel. No data may be sent or receieved after this method
completes. | [
"Closes",
"the",
"channel",
".",
"No",
"data",
"may",
"be",
"sent",
"or",
"receieved",
"after",
"this",
"method",
"completes",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java#L815-L890 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java | Ssh2Channel.channelRequest | protected void channelRequest(String requesttype, boolean wantreply,
byte[] requestdata) throws SshException {
if (wantreply) {
ByteArrayWriter msg = new ByteArrayWriter();
try {
msg.write((byte) SSH_MSG_CHANNEL_FAILURE);
msg.writeInt(remoteid);
connection.sendMessage(msg.toByteArray(), true);
... | java | protected void channelRequest(String requesttype, boolean wantreply,
byte[] requestdata) throws SshException {
if (wantreply) {
ByteArrayWriter msg = new ByteArrayWriter();
try {
msg.write((byte) SSH_MSG_CHANNEL_FAILURE);
msg.writeInt(remoteid);
connection.sendMessage(msg.toByteArray(), true);
... | [
"protected",
"void",
"channelRequest",
"(",
"String",
"requesttype",
",",
"boolean",
"wantreply",
",",
"byte",
"[",
"]",
"requestdata",
")",
"throws",
"SshException",
"{",
"if",
"(",
"wantreply",
")",
"{",
"ByteArrayWriter",
"msg",
"=",
"new",
"ByteArrayWriter",... | Called when a channel request is received, by default this method sends a
failure message if the remote side requests a reply. Overidden methods
should ALWAYS call this superclass method.
@param requesttype
the name of the request
@param wantreply
specifies whether the remote side requires a success/failure
message
@p... | [
"Called",
"when",
"a",
"channel",
"request",
"is",
"received",
"by",
"default",
"this",
"method",
"sends",
"a",
"failure",
"message",
"if",
"the",
"remote",
"side",
"requests",
"a",
"reply",
".",
"Overidden",
"methods",
"should",
"ALWAYS",
"call",
"this",
"s... | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java#L943-L961 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java | Ssh2Context.setPreferredCipherCS | public void setPreferredCipherCS(String name) throws SshException {
if (name == null)
return;
if (ciphersCS.contains(name)) {
prefCipherCS = name;
setCipherPreferredPositionCS(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | java | public void setPreferredCipherCS(String name) throws SshException {
if (name == null)
return;
if (ciphersCS.contains(name)) {
prefCipherCS = name;
setCipherPreferredPositionCS(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | [
"public",
"void",
"setPreferredCipherCS",
"(",
"String",
"name",
")",
"throws",
"SshException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
";",
"if",
"(",
"ciphersCS",
".",
"contains",
"(",
"name",
")",
")",
"{",
"prefCipherCS",
"=",
"name",
";... | Set the preferred cipher for the Client->Server stream.
@param name
@throws SshException | [
"Set",
"the",
"preferred",
"cipher",
"for",
"the",
"Client",
"-",
">",
"Server",
"stream",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java#L384-L396 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java | Ssh2Context.setPreferredCipherSC | public void setPreferredCipherSC(String name) throws SshException {
if (name == null)
return;
if (ciphersSC.contains(name)) {
prefCipherSC = name;
setCipherPreferredPositionSC(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | java | public void setPreferredCipherSC(String name) throws SshException {
if (name == null)
return;
if (ciphersSC.contains(name)) {
prefCipherSC = name;
setCipherPreferredPositionSC(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | [
"public",
"void",
"setPreferredCipherSC",
"(",
"String",
"name",
")",
"throws",
"SshException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
";",
"if",
"(",
"ciphersSC",
".",
"contains",
"(",
"name",
")",
")",
"{",
"prefCipherSC",
"=",
"name",
";... | Set the preferred cipher for the Server->Client stream.
@param name
@throws SshException | [
"Set",
"the",
"preferred",
"cipher",
"for",
"the",
"Server",
"-",
">",
"Client",
"stream",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java#L531-L543 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java | Ssh2Context.setPreferredMacCS | public void setPreferredMacCS(String name) throws SshException {
if (name == null)
return;
if (macCS.contains(name)) {
prefMacCS = name;
setMacPreferredPositionCS(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | java | public void setPreferredMacCS(String name) throws SshException {
if (name == null)
return;
if (macCS.contains(name)) {
prefMacCS = name;
setMacPreferredPositionCS(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | [
"public",
"void",
"setPreferredMacCS",
"(",
"String",
"name",
")",
"throws",
"SshException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
";",
"if",
"(",
"macCS",
".",
"contains",
"(",
"name",
")",
")",
"{",
"prefMacCS",
"=",
"name",
";",
"setM... | Set the preferred mac for the Client->Server stream.
@param name
@throws SshException | [
"Set",
"the",
"preferred",
"mac",
"for",
"the",
"Client",
"-",
">",
"Server",
"stream",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java#L578-L590 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java | Ssh2Context.setPreferredMacSC | public void setPreferredMacSC(String name) throws SshException {
if (name == null)
return;
if (macSC.contains(name)) {
prefMacSC = name;
setMacPreferredPositionSC(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | java | public void setPreferredMacSC(String name) throws SshException {
if (name == null)
return;
if (macSC.contains(name)) {
prefMacSC = name;
setMacPreferredPositionSC(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | [
"public",
"void",
"setPreferredMacSC",
"(",
"String",
"name",
")",
"throws",
"SshException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
";",
"if",
"(",
"macSC",
".",
"contains",
"(",
"name",
")",
")",
"{",
"prefMacSC",
"=",
"name",
";",
"setM... | Set the preferred mac for the Server->Client stream.
@param name
@throws SshException | [
"Set",
"the",
"preferred",
"mac",
"for",
"the",
"Server",
"-",
">",
"Client",
"stream",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java#L607-L619 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java | Ssh2Context.setPreferredCompressionCS | public void setPreferredCompressionCS(String name) throws SshException {
if (name == null)
return;
if (compressionsCS.contains(name)) {
prefCompressionCS = name;
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | java | public void setPreferredCompressionCS(String name) throws SshException {
if (name == null)
return;
if (compressionsCS.contains(name)) {
prefCompressionCS = name;
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | [
"public",
"void",
"setPreferredCompressionCS",
"(",
"String",
"name",
")",
"throws",
"SshException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
";",
"if",
"(",
"compressionsCS",
".",
"contains",
"(",
"name",
")",
")",
"{",
"prefCompressionCS",
"=",... | Set the preferred compression for the Client->Server stream.
@param name
@throws SshException | [
"Set",
"the",
"preferred",
"compression",
"for",
"the",
"Client",
"-",
">",
"Server",
"stream",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java#L654-L665 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java | Ssh2Context.setPreferredCompressionSC | public void setPreferredCompressionSC(String name) throws SshException {
if (name == null)
return;
if (compressionsSC.contains(name)) {
prefCompressionSC = name;
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | java | public void setPreferredCompressionSC(String name) throws SshException {
if (name == null)
return;
if (compressionsSC.contains(name)) {
prefCompressionSC = name;
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | [
"public",
"void",
"setPreferredCompressionSC",
"(",
"String",
"name",
")",
"throws",
"SshException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
";",
"if",
"(",
"compressionsSC",
".",
"contains",
"(",
"name",
")",
")",
"{",
"prefCompressionSC",
"=",... | Set the preferred compression for the Server->Client stream.
@param name
@throws SshException | [
"Set",
"the",
"preferred",
"compression",
"for",
"the",
"Server",
"-",
">",
"Client",
"stream",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java#L682-L693 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java | Ssh2Context.setPreferredKeyExchange | public void setPreferredKeyExchange(String name) throws SshException {
if (name == null)
return;
if (keyExchanges.contains(name)) {
prefKeyExchange = name;
setKeyExchangePreferredPosition(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
... | java | public void setPreferredKeyExchange(String name) throws SshException {
if (name == null)
return;
if (keyExchanges.contains(name)) {
prefKeyExchange = name;
setKeyExchangePreferredPosition(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
... | [
"public",
"void",
"setPreferredKeyExchange",
"(",
"String",
"name",
")",
"throws",
"SshException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
";",
"if",
"(",
"keyExchanges",
".",
"contains",
"(",
"name",
")",
")",
"{",
"prefKeyExchange",
"=",
"na... | Set the preferred key exchange method.
@param name
@throws SshException | [
"Set",
"the",
"preferred",
"key",
"exchange",
"method",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java#L749-L761 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java | Ssh2Context.setPreferredPublicKey | public void setPreferredPublicKey(String name) throws SshException {
if (name == null)
return;
if (publicKeys.contains(name)) {
prefPublicKey = name;
setPublicKeyPreferredPosition(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | java | public void setPreferredPublicKey(String name) throws SshException {
if (name == null)
return;
if (publicKeys.contains(name)) {
prefPublicKey = name;
setPublicKeyPreferredPosition(name, 0);
} else {
throw new SshException(name + " is not supported",
SshException.UNSUPPORTED_ALGORITHM);
}
} | [
"public",
"void",
"setPreferredPublicKey",
"(",
"String",
"name",
")",
"throws",
"SshException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"return",
";",
"if",
"(",
"publicKeys",
".",
"contains",
"(",
"name",
")",
")",
"{",
"prefPublicKey",
"=",
"name",
... | Set the preferred public key algorithm.
@param name
@throws SshException | [
"Set",
"the",
"preferred",
"public",
"key",
"algorithm",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Context.java#L787-L799 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFileInputStream.java | SftpFileInputStream.close | public void close() throws IOException {
try {
file.close();
UnsignedInteger32 requestid;
while (outstandingRequests.size() > 0) {
requestid = (UnsignedInteger32) outstandingRequests
.elementAt(0);
outstandingRequests.removeElementAt(0);
sftp.getResponse(requestid);
}
} catch (SshExce... | java | public void close() throws IOException {
try {
file.close();
UnsignedInteger32 requestid;
while (outstandingRequests.size() > 0) {
requestid = (UnsignedInteger32) outstandingRequests
.elementAt(0);
outstandingRequests.removeElementAt(0);
sftp.getResponse(requestid);
}
} catch (SshExce... | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"file",
".",
"close",
"(",
")",
";",
"UnsignedInteger32",
"requestid",
";",
"while",
"(",
"outstandingRequests",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"requestid",
"=",
... | Closes the SFTP file handle. | [
"Closes",
"the",
"SFTP",
"file",
"handle",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFileInputStream.java#L227-L243 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/logging/Log.java | Log.debug | public static void debug(Object source, String message, Throwable t) {
LoggerFactory.getInstance().log(LoggerLevel.DEBUG, source, message, t);
} | java | public static void debug(Object source, String message, Throwable t) {
LoggerFactory.getInstance().log(LoggerLevel.DEBUG, source, message, t);
} | [
"public",
"static",
"void",
"debug",
"(",
"Object",
"source",
",",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"LoggerFactory",
".",
"getInstance",
"(",
")",
".",
"log",
"(",
"LoggerLevel",
".",
"DEBUG",
",",
"source",
",",
"message",
",",
"t",... | An error log event
@param source
@param message | [
"An",
"error",
"log",
"event"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/logging/Log.java#L71-L73 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/logging/Log.java | Log.debug | public static void debug(Object source, String message) {
LoggerFactory.getInstance().log(LoggerLevel.INFO, source, message);
} | java | public static void debug(Object source, String message) {
LoggerFactory.getInstance().log(LoggerLevel.INFO, source, message);
} | [
"public",
"static",
"void",
"debug",
"(",
"Object",
"source",
",",
"String",
"message",
")",
"{",
"LoggerFactory",
".",
"getInstance",
"(",
")",
".",
"log",
"(",
"LoggerLevel",
".",
"INFO",
",",
"source",
",",
"message",
")",
";",
"}"
] | A debug event
@param source
@param message | [
"A",
"debug",
"event"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/logging/Log.java#L80-L82 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/logging/Log.java | Log.error | public static void error(Object source, String message, Throwable t) {
LoggerFactory.getInstance().log(LoggerLevel.ERROR, source, message, t);
} | java | public static void error(Object source, String message, Throwable t) {
LoggerFactory.getInstance().log(LoggerLevel.ERROR, source, message, t);
} | [
"public",
"static",
"void",
"error",
"(",
"Object",
"source",
",",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"LoggerFactory",
".",
"getInstance",
"(",
")",
".",
"log",
"(",
"LoggerLevel",
".",
"ERROR",
",",
"source",
",",
"message",
",",
"t",... | An exception event
@param source
@param message
@param t | [
"An",
"exception",
"event"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/logging/Log.java#L91-L93 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/UserPasswordAuthentication.java | UserPasswordAuthentication.formRequest | private void formRequest(){
byte[] user_bytes = userName.getBytes();
byte[] password_bytes = password.getBytes();
request = new byte[3+user_bytes.length+password_bytes.length];
request[0] = (byte) 1;
request[1] = (byte) user_bytes.length;
System.arraycopy(user_bytes,0,request,2,use... | java | private void formRequest(){
byte[] user_bytes = userName.getBytes();
byte[] password_bytes = password.getBytes();
request = new byte[3+user_bytes.length+password_bytes.length];
request[0] = (byte) 1;
request[1] = (byte) user_bytes.length;
System.arraycopy(user_bytes,0,request,2,use... | [
"private",
"void",
"formRequest",
"(",
")",
"{",
"byte",
"[",
"]",
"user_bytes",
"=",
"userName",
".",
"getBytes",
"(",
")",
";",
"byte",
"[",
"]",
"password_bytes",
"=",
"password",
".",
"getBytes",
"(",
")",
";",
"request",
"=",
"new",
"byte",
"[",
... | Convert UserName password in to binary form, ready to be send to server | [
"Convert",
"UserName",
"password",
"in",
"to",
"binary",
"form",
"ready",
"to",
"be",
"send",
"to",
"server"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/UserPasswordAuthentication.java#L87-L98 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocol.java | TransportProtocol.startTransportProtocol | public void startTransportProtocol(SshTransport provider,
Ssh2Context context, String localIdentification,
String remoteIdentification, Ssh2Client client) throws SshException {
try {
this.transportIn = new DataInputStream(provider.getInputStream());
this.transportOut = provider.getOutputStream();
this... | java | public void startTransportProtocol(SshTransport provider,
Ssh2Context context, String localIdentification,
String remoteIdentification, Ssh2Client client) throws SshException {
try {
this.transportIn = new DataInputStream(provider.getInputStream());
this.transportOut = provider.getOutputStream();
this... | [
"public",
"void",
"startTransportProtocol",
"(",
"SshTransport",
"provider",
",",
"Ssh2Context",
"context",
",",
"String",
"localIdentification",
",",
"String",
"remoteIdentification",
",",
"Ssh2Client",
"client",
")",
"throws",
"SshException",
"{",
"try",
"{",
"this"... | Starts the protocol on the provider. | [
"Starts",
"the",
"protocol",
"on",
"the",
"provider",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocol.java#L325-L364 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocol.java | TransportProtocol.disconnect | public void disconnect(int reason, String disconnectReason) {
ByteArrayWriter baw = new ByteArrayWriter();
try {
this.disconnectReason = disconnectReason;
baw.write(SSH_MSG_DISCONNECT);
baw.writeInt(reason);
baw.writeString(disconnectReason);
baw.writeString("");
Log.info(this, "Sending SSH_MS... | java | public void disconnect(int reason, String disconnectReason) {
ByteArrayWriter baw = new ByteArrayWriter();
try {
this.disconnectReason = disconnectReason;
baw.write(SSH_MSG_DISCONNECT);
baw.writeInt(reason);
baw.writeString(disconnectReason);
baw.writeString("");
Log.info(this, "Sending SSH_MS... | [
"public",
"void",
"disconnect",
"(",
"int",
"reason",
",",
"String",
"disconnectReason",
")",
"{",
"ByteArrayWriter",
"baw",
"=",
"new",
"ByteArrayWriter",
"(",
")",
";",
"try",
"{",
"this",
".",
"disconnectReason",
"=",
"disconnectReason",
";",
"baw",
".",
... | Disconnect from the remote host. No more messages can be sent after this
method has been called.
@param reason
@param disconnectReason
, description
@throws IOException | [
"Disconnect",
"from",
"the",
"remote",
"host",
".",
"No",
"more",
"messages",
"can",
"be",
"sent",
"after",
"this",
"method",
"has",
"been",
"called",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocol.java#L394-L419 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocol.java | TransportProtocol.nextMessage | public byte[] nextMessage() throws SshException {
if (Log.isDebugEnabled()) {
if (verbose) {
Log.debug(this, "transport next message");
}
}
synchronized (transportIn) {
byte[] msg;
do {
msg = readMessage();
} while (processMessage(msg));
return msg;
}
} | java | public byte[] nextMessage() throws SshException {
if (Log.isDebugEnabled()) {
if (verbose) {
Log.debug(this, "transport next message");
}
}
synchronized (transportIn) {
byte[] msg;
do {
msg = readMessage();
} while (processMessage(msg));
return msg;
}
} | [
"public",
"byte",
"[",
"]",
"nextMessage",
"(",
")",
"throws",
"SshException",
"{",
"if",
"(",
"Log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"verbose",
")",
"{",
"Log",
".",
"debug",
"(",
"this",
",",
"\"transport next message\"",
")",
"... | Get the next message. The message returned will be the full message data
so skipping the first 5 bytes is required before the message data can be
read.
@return a byte array containing all the message data
@throws IOException | [
"Get",
"the",
"next",
"message",
".",
"The",
"message",
"returned",
"will",
"be",
"the",
"full",
"message",
"data",
"so",
"skipping",
"the",
"first",
"5",
"bytes",
"is",
"required",
"before",
"the",
"message",
"data",
"can",
"be",
"read",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocol.java#L560-L576 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocol.java | TransportProtocol.startService | public void startService(String servicename) throws SshException {
ByteArrayWriter baw = new ByteArrayWriter();
try {
baw.write(SSH_MSG_SERVICE_REQUEST);
baw.writeString(servicename);
if (Log.isDebugEnabled()) {
Log.debug(this, "Sending SSH_MSG_SERVICE_REQUEST");
}
sendMessage(baw.toByteArray... | java | public void startService(String servicename) throws SshException {
ByteArrayWriter baw = new ByteArrayWriter();
try {
baw.write(SSH_MSG_SERVICE_REQUEST);
baw.writeString(servicename);
if (Log.isDebugEnabled()) {
Log.debug(this, "Sending SSH_MSG_SERVICE_REQUEST");
}
sendMessage(baw.toByteArray... | [
"public",
"void",
"startService",
"(",
"String",
"servicename",
")",
"throws",
"SshException",
"{",
"ByteArrayWriter",
"baw",
"=",
"new",
"ByteArrayWriter",
"(",
")",
";",
"try",
"{",
"baw",
".",
"write",
"(",
"SSH_MSG_SERVICE_REQUEST",
")",
";",
"baw",
".",
... | Request that the remote server starts a transport protocol service. This
is only available in CLIENT_MODE.
@param servicename
@throws IOException | [
"Request",
"that",
"the",
"remote",
"server",
"starts",
"a",
"transport",
"protocol",
"service",
".",
"This",
"is",
"only",
"available",
"in",
"CLIENT_MODE",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocol.java#L1383-L1415 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocol.java | TransportProtocol.processMessage | public boolean processMessage(byte[] msg) throws SshException {
try {
if (msg.length < 1) {
disconnect(TransportProtocol.PROTOCOL_ERROR,
"Invalid message received");
throw new SshException("Invalid transport protocol message",
SshException.INTERNAL_ERROR);
}
switch (msg[0]) {
case SS... | java | public boolean processMessage(byte[] msg) throws SshException {
try {
if (msg.length < 1) {
disconnect(TransportProtocol.PROTOCOL_ERROR,
"Invalid message received");
throw new SshException("Invalid transport protocol message",
SshException.INTERNAL_ERROR);
}
switch (msg[0]) {
case SS... | [
"public",
"boolean",
"processMessage",
"(",
"byte",
"[",
"]",
"msg",
")",
"throws",
"SshException",
"{",
"try",
"{",
"if",
"(",
"msg",
".",
"length",
"<",
"1",
")",
"{",
"disconnect",
"(",
"TransportProtocol",
".",
"PROTOCOL_ERROR",
",",
"\"Invalid message r... | Process a message. This should be called when reading messages from
outside of the transport protocol so that the transport protocol can
parse its own messages.
@param msg
@return <code>true</code> if the message was processed by the transport
and can be discarded, otherwise <code>false</code>.
@throws SshException | [
"Process",
"a",
"message",
".",
"This",
"should",
"be",
"called",
"when",
"reading",
"messages",
"from",
"outside",
"of",
"the",
"transport",
"protocol",
"so",
"that",
"the",
"transport",
"protocol",
"can",
"parse",
"its",
"own",
"messages",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/TransportProtocol.java#L1471-L1556 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/SshKeyFingerprint.java | SshKeyFingerprint.getFingerprint | public static String getFingerprint(byte[] encoded, String algorithm)
throws SshException {
Digest md5 = (Digest) ComponentManager.getInstance().supportedDigests()
.getInstance(algorithm);
md5.putBytes(encoded);
byte[] digest = md5.doFinal();
StringBuffer buf = new StringBuffer();
int ch;
for (in... | java | public static String getFingerprint(byte[] encoded, String algorithm)
throws SshException {
Digest md5 = (Digest) ComponentManager.getInstance().supportedDigests()
.getInstance(algorithm);
md5.putBytes(encoded);
byte[] digest = md5.doFinal();
StringBuffer buf = new StringBuffer();
int ch;
for (in... | [
"public",
"static",
"String",
"getFingerprint",
"(",
"byte",
"[",
"]",
"encoded",
",",
"String",
"algorithm",
")",
"throws",
"SshException",
"{",
"Digest",
"md5",
"=",
"(",
"Digest",
")",
"ComponentManager",
".",
"getInstance",
"(",
")",
".",
"supportedDigests... | Generate an SSH key fingerprint with a specific algorithm.
@param encoded
@param algorithm
@return the key fingerprint, for example
"c1:b1:30:29:d7:b8:de:6c:97:77:10:d7:46:41:63:87" | [
"Generate",
"an",
"SSH",
"key",
"fingerprint",
"with",
"a",
"specific",
"algorithm",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/SshKeyFingerprint.java#L66-L88 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java | SftpFile.canWrite | public boolean canWrite() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IWUSR) == SftpFileAttributes.S_IWUSR
|| (getAttributes().getPermissions().longValue() & SftpFileAt... | java | public boolean canWrite() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IWUSR) == SftpFileAttributes.S_IWUSR
|| (getAttributes().getPermissions().longValue() & SftpFileAt... | [
"public",
"boolean",
"canWrite",
"(",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"// This is long hand because gcj chokes when it is not? Investigate why",
"if",
"(",
"(",
"getAttributes",
"(",
")",
".",
"getPermissions",
"(",
")",
".",
"longValue",
... | Determine whether the user has write access to the file. This checks the
S_IWUSR flag is set in permissions.
@return boolean
@throws SftpStatusException
@throws SshException | [
"Determine",
"whether",
"the",
"user",
"has",
"write",
"access",
"to",
"the",
"file",
".",
"This",
"checks",
"the",
"S_IWUSR",
"flag",
"is",
"set",
"in",
"permissions",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java#L182-L190 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java | SftpFile.canRead | public boolean canRead() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IRUSR) == SftpFileAttributes.S_IRUSR
|| (getAttributes().getPermissions().longValue() & SftpFileAtt... | java | public boolean canRead() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IRUSR) == SftpFileAttributes.S_IRUSR
|| (getAttributes().getPermissions().longValue() & SftpFileAtt... | [
"public",
"boolean",
"canRead",
"(",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"// This is long hand because gcj chokes when it is not? Investigate why",
"if",
"(",
"(",
"getAttributes",
"(",
")",
".",
"getPermissions",
"(",
")",
".",
"longValue",
... | Determine whether the user has read access to the file. This checks the
S_IRUSR flag is set in permissions.
@return boolean
@throws SftpStatusException
@throws SshException | [
"Determine",
"whether",
"the",
"user",
"has",
"read",
"access",
"to",
"the",
"file",
".",
"This",
"checks",
"the",
"S_IRUSR",
"flag",
"is",
"set",
"in",
"permissions",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java#L200-L208 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java | SftpFile.getAttributes | public SftpFileAttributes getAttributes() throws SftpStatusException,
SshException {
if (attrs == null) {
attrs = sftp.getAttributes(getAbsolutePath());
}
return attrs;
} | java | public SftpFileAttributes getAttributes() throws SftpStatusException,
SshException {
if (attrs == null) {
attrs = sftp.getAttributes(getAbsolutePath());
}
return attrs;
} | [
"public",
"SftpFileAttributes",
"getAttributes",
"(",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"if",
"(",
"attrs",
"==",
"null",
")",
"{",
"attrs",
"=",
"sftp",
".",
"getAttributes",
"(",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"re... | Get the files attributes.
@return SftpFileAttributes
@throws SshException
@throws SftpStatusException | [
"Get",
"the",
"files",
"attributes",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java#L275-L282 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java | SftpFile.isFifo | public boolean isFifo() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IFIFO) == SftpFileAttributes.S_IFIFO)
return true;
return false;
} | java | public boolean isFifo() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IFIFO) == SftpFileAttributes.S_IFIFO)
return true;
return false;
} | [
"public",
"boolean",
"isFifo",
"(",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"// This is long hand because gcj chokes when it is not? Investigate why",
"if",
"(",
"(",
"getAttributes",
"(",
")",
".",
"getPermissions",
"(",
")",
".",
"longValue",
"... | Determine whether the file is pointing to a pipe.
@return boolean
@throws SshException
@throws SftpStatusException | [
"Determine",
"whether",
"the",
"file",
"is",
"pointing",
"to",
"a",
"pipe",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java#L347-L352 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java | SftpFile.isBlock | public boolean isBlock() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IFBLK) == SftpFileAttributes.S_IFBLK) {
return true;
}
return false;
} | java | public boolean isBlock() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IFBLK) == SftpFileAttributes.S_IFBLK) {
return true;
}
return false;
} | [
"public",
"boolean",
"isBlock",
"(",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"// This is long hand because gcj chokes when it is not? Investigate why",
"if",
"(",
"(",
"getAttributes",
"(",
")",
".",
"getPermissions",
"(",
")",
".",
"longValue",
... | Determine whether the file is pointing to a block special file.
@return boolean
@throws SshException
@throws SftpStatusException | [
"Determine",
"whether",
"the",
"file",
"is",
"pointing",
"to",
"a",
"block",
"special",
"file",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java#L361-L367 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java | SftpFile.isCharacter | public boolean isCharacter() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IFCHR) == SftpFileAttributes.S_IFCHR) {
return true;
}
return false;
} | java | public boolean isCharacter() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IFCHR) == SftpFileAttributes.S_IFCHR) {
return true;
}
return false;
} | [
"public",
"boolean",
"isCharacter",
"(",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"// This is long hand because gcj chokes when it is not? Investigate why",
"if",
"(",
"(",
"getAttributes",
"(",
")",
".",
"getPermissions",
"(",
")",
".",
"longValue"... | Determine whether the file is pointing to a character mode device.
@return boolean
@throws SshException
@throws SftpStatusException | [
"Determine",
"whether",
"the",
"file",
"is",
"pointing",
"to",
"a",
"character",
"mode",
"device",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java#L376-L382 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java | SftpFile.isSocket | public boolean isSocket() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IFSOCK) == SftpFileAttributes.S_IFSOCK) {
return true;
}
return false;
} | java | public boolean isSocket() throws SftpStatusException, SshException {
// This is long hand because gcj chokes when it is not? Investigate why
if ((getAttributes().getPermissions().longValue() & SftpFileAttributes.S_IFSOCK) == SftpFileAttributes.S_IFSOCK) {
return true;
}
return false;
} | [
"public",
"boolean",
"isSocket",
"(",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"// This is long hand because gcj chokes when it is not? Investigate why",
"if",
"(",
"(",
"getAttributes",
"(",
")",
".",
"getPermissions",
"(",
")",
".",
"longValue",
... | Determine whether the file is pointing to a socket.
@return boolean
@throws SshException
@throws SftpStatusException | [
"Determine",
"whether",
"the",
"file",
"is",
"pointing",
"to",
"a",
"socket",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpFile.java#L391-L397 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/util/DynamicBuffer.java | DynamicBuffer.write | protected synchronized void write(int b) throws IOException {
if (closed) {
throw new IOException("The buffer is closed");
}
verifyBufferSize(1);
buf[writepos] = (byte) b;
writepos++;
notifyAll();
} | java | protected synchronized void write(int b) throws IOException {
if (closed) {
throw new IOException("The buffer is closed");
}
verifyBufferSize(1);
buf[writepos] = (byte) b;
writepos++;
notifyAll();
} | [
"protected",
"synchronized",
"void",
"write",
"(",
"int",
"b",
")",
"throws",
"IOException",
"{",
"if",
"(",
"closed",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"The buffer is closed\"",
")",
";",
"}",
"verifyBufferSize",
"(",
"1",
")",
";",
"buf",
"... | Write a byte array to the buffer
@param b
@throws IOException | [
"Write",
"a",
"byte",
"array",
"to",
"the",
"buffer"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/DynamicBuffer.java#L145-L155 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/util/DynamicBuffer.java | DynamicBuffer.read | protected synchronized int read() throws IOException {
try {
block();
} catch (InterruptedException ex) {
throw new InterruptedIOException(
"The blocking operation was interrupted");
}
if (closed && available() <= 0) {
return -1;
}
return buf[readpos++];
} | java | protected synchronized int read() throws IOException {
try {
block();
} catch (InterruptedException ex) {
throw new InterruptedIOException(
"The blocking operation was interrupted");
}
if (closed && available() <= 0) {
return -1;
}
return buf[readpos++];
} | [
"protected",
"synchronized",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"block",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"throw",
"new",
"InterruptedIOException",
"(",
"\"The blocking operation was interrup... | Read a byte from the buffer
@return
@throws IOException
@throws InterruptedIOException | [
"Read",
"a",
"byte",
"from",
"the",
"buffer"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/DynamicBuffer.java#L192-L206 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/util/DynamicBuffer.java | DynamicBuffer.read | protected synchronized int read(byte[] data, int offset, int len)
throws IOException {
try {
block();
} catch (InterruptedException ex) {
throw new InterruptedIOException(
"The blocking operation was interrupted");
}
if (closed && available() <= 0) {
return -1;
}
int read = (len > (write... | java | protected synchronized int read(byte[] data, int offset, int len)
throws IOException {
try {
block();
} catch (InterruptedException ex) {
throw new InterruptedIOException(
"The blocking operation was interrupted");
}
if (closed && available() <= 0) {
return -1;
}
int read = (len > (write... | [
"protected",
"synchronized",
"int",
"read",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"try",
"{",
"block",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"throw... | Read a byte array from the buffer
@param data
@param offset
@param len
@return
@throws IOException
@throws InterruptedIOException | [
"Read",
"a",
"byte",
"array",
"from",
"the",
"buffer"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/DynamicBuffer.java#L220-L240 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/components/ComponentFactory.java | ComponentFactory.add | public synchronized void add(String name, Class<?> cls) {
if (locked) {
throw new IllegalStateException(
"Component factory is locked. Components cannot be added");
}
supported.put(name, cls);
// add name to end of order vector
if (!order.contains(name))
order.addElement(name);
} | java | public synchronized void add(String name, Class<?> cls) {
if (locked) {
throw new IllegalStateException(
"Component factory is locked. Components cannot be added");
}
supported.put(name, cls);
// add name to end of order vector
if (!order.contains(name))
order.addElement(name);
} | [
"public",
"synchronized",
"void",
"add",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"if",
"(",
"locked",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Component factory is locked. Components cannot be added\"",
")",
";",
"}... | Add a new component type to the factory. This method throws an exception
if the class cannot be resolved. The name of the component IS NOT
verified to allow component implementations to be overridden.
@param name
@param cls
@throws ClassNotFoundException | [
"Add",
"a",
"new",
"component",
"type",
"to",
"the",
"factory",
".",
"This",
"method",
"throws",
"an",
"exception",
"if",
"the",
"class",
"cannot",
"be",
"resolved",
".",
"The",
"name",
"of",
"the",
"component",
"IS",
"NOT",
"verified",
"to",
"allow",
"c... | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/ComponentFactory.java#L151-L161 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/components/ComponentFactory.java | ComponentFactory.getInstance | public Object getInstance(String name) throws SshException {
if (supported.containsKey(name)) {
try {
return createInstance(name, (Class<?>) supported.get(name));
} catch (Throwable t) {
throw new SshException(t.getMessage(),
SshException.INTERNAL_ERROR);
}
}
throw new SshException(name + "... | java | public Object getInstance(String name) throws SshException {
if (supported.containsKey(name)) {
try {
return createInstance(name, (Class<?>) supported.get(name));
} catch (Throwable t) {
throw new SshException(t.getMessage(),
SshException.INTERNAL_ERROR);
}
}
throw new SshException(name + "... | [
"public",
"Object",
"getInstance",
"(",
"String",
"name",
")",
"throws",
"SshException",
"{",
"if",
"(",
"supported",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"try",
"{",
"return",
"createInstance",
"(",
"name",
",",
"(",
"Class",
"<",
"?",
">",
... | Get a new instance of a supported component.
@param name
The name of the component; for example "3des-cbc"
@return the newly instantiated object
@throws ClassNotFoundException | [
"Get",
"a",
"new",
"instance",
"of",
"a",
"supported",
"component",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/ComponentFactory.java#L171-L182 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/components/ComponentFactory.java | ComponentFactory.createDelimitedList | private synchronized String createDelimitedList(String preferred) {
StringBuffer listBuf = new StringBuffer();
int prefIndex = order.indexOf(preferred);
// remove preferred and add it back at the end to ensure it is not
// duplicated in the list returned
if (prefIndex != -1) {
listBuf.append(preferred);
... | java | private synchronized String createDelimitedList(String preferred) {
StringBuffer listBuf = new StringBuffer();
int prefIndex = order.indexOf(preferred);
// remove preferred and add it back at the end to ensure it is not
// duplicated in the list returned
if (prefIndex != -1) {
listBuf.append(preferred);
... | [
"private",
"synchronized",
"String",
"createDelimitedList",
"(",
"String",
"preferred",
")",
"{",
"StringBuffer",
"listBuf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"prefIndex",
"=",
"order",
".",
"indexOf",
"(",
"preferred",
")",
";",
"// remove prefe... | Create a delimited list of supported components.
@param preferred
@return a comma delimited list | [
"Create",
"a",
"delimited",
"list",
"of",
"supported",
"components",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/ComponentFactory.java#L201-L221 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/SocksServerSocket.java | SocksServerSocket.accept | public Socket accept() throws IOException{
Socket s;
if(!doing_direct){
if(proxy == null) return null;
ProxyMessage msg = proxy.accept();
s = msg.ip == null? new SocksSocket(msg.host,msg.port,proxy)
: new SocksSocket(msg.ip,msg.port,proxy);
... | java | public Socket accept() throws IOException{
Socket s;
if(!doing_direct){
if(proxy == null) return null;
ProxyMessage msg = proxy.accept();
s = msg.ip == null? new SocksSocket(msg.host,msg.port,proxy)
: new SocksSocket(msg.ip,msg.port,proxy);
... | [
"public",
"Socket",
"accept",
"(",
")",
"throws",
"IOException",
"{",
"Socket",
"s",
";",
"if",
"(",
"!",
"doing_direct",
")",
"{",
"if",
"(",
"proxy",
"==",
"null",
")",
"return",
"null",
";",
"ProxyMessage",
"msg",
"=",
"proxy",
".",
"accept",
"(",
... | Accepts the incoming connection. | [
"Accepts",
"the",
"incoming",
"connection",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/SocksServerSocket.java#L115-L144 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/SocksServerSocket.java | SocksServerSocket.getInetAddress | public InetAddress getInetAddress(){
if(localIP == null){
try{
localIP = InetAddress.getByName(localHost);
}catch(UnknownHostException e){
return null;
}
}
return localIP;
} | java | public InetAddress getInetAddress(){
if(localIP == null){
try{
localIP = InetAddress.getByName(localHost);
}catch(UnknownHostException e){
return null;
}
}
return localIP;
} | [
"public",
"InetAddress",
"getInetAddress",
"(",
")",
"{",
"if",
"(",
"localIP",
"==",
"null",
")",
"{",
"try",
"{",
"localIP",
"=",
"InetAddress",
".",
"getByName",
"(",
"localHost",
")",
";",
"}",
"catch",
"(",
"UnknownHostException",
"e",
")",
"{",
"re... | Get address assigned by proxy to listen for incomming
connections, or the local machine address if doing direct
connection. | [
"Get",
"address",
"assigned",
"by",
"proxy",
"to",
"listen",
"for",
"incomming",
"connections",
"or",
"the",
"local",
"machine",
"address",
"if",
"doing",
"direct",
"connection",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/SocksServerSocket.java#L174-L183 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/SocksServerSocket.java | SocksServerSocket.setSoTimeout | public void setSoTimeout(int timeout) throws SocketException{
super.setSoTimeout(timeout);
if(!doing_direct) proxy.proxySocket.setSoTimeout(timeout);
} | java | public void setSoTimeout(int timeout) throws SocketException{
super.setSoTimeout(timeout);
if(!doing_direct) proxy.proxySocket.setSoTimeout(timeout);
} | [
"public",
"void",
"setSoTimeout",
"(",
"int",
"timeout",
")",
"throws",
"SocketException",
"{",
"super",
".",
"setSoTimeout",
"(",
"timeout",
")",
";",
"if",
"(",
"!",
"doing_direct",
")",
"proxy",
".",
"proxySocket",
".",
"setSoTimeout",
"(",
"timeout",
")"... | Set Timeout.
@param timeout Amount of time in milliseconds, accept should wait for
incoming connection before failing with exception.
Zero timeout implies infinity. | [
"Set",
"Timeout",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/SocksServerSocket.java#L200-L203 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpStatusException.java | SftpStatusException.getStatusText | public static String getStatusText(int status) {
switch (status) {
case SSH_FX_OK:
return "OK";
case SSH_FX_EOF:
return "EOF";
case SSH_FX_NO_SUCH_FILE:
return "No such file.";
case SSH_FX_PERMISSION_DENIED:
return "Permission denied.";
case SSH_FX_FAILURE:
return "Server responded with an un... | java | public static String getStatusText(int status) {
switch (status) {
case SSH_FX_OK:
return "OK";
case SSH_FX_EOF:
return "EOF";
case SSH_FX_NO_SUCH_FILE:
return "No such file.";
case SSH_FX_PERMISSION_DENIED:
return "Permission denied.";
case SSH_FX_FAILURE:
return "Server responded with an un... | [
"public",
"static",
"String",
"getStatusText",
"(",
"int",
"status",
")",
"{",
"switch",
"(",
"status",
")",
"{",
"case",
"SSH_FX_OK",
":",
"return",
"\"OK\"",
";",
"case",
"SSH_FX_EOF",
":",
"return",
"\"EOF\"",
";",
"case",
"SSH_FX_NO_SUCH_FILE",
":",
"ret... | Convert a SSH_FXP_STATUS code into a readable string
@param status
@return | [
"Convert",
"a",
"SSH_FXP_STATUS",
"code",
"into",
"a",
"readable",
"string"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpStatusException.java#L123-L195 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/publickey/SshPublicKeyFileFactory.java | SshPublicKeyFileFactory.parse | public static SshPublicKeyFile parse(byte[] formattedkey)
throws IOException {
try {
try {
return new OpenSSHPublicKeyFile(formattedkey);
} catch (IOException ex) {
try {
return new SECSHPublicKeyFile(formattedkey);
} catch (IOException ex2) {
throw new IOException(
"Unable to pa... | java | public static SshPublicKeyFile parse(byte[] formattedkey)
throws IOException {
try {
try {
return new OpenSSHPublicKeyFile(formattedkey);
} catch (IOException ex) {
try {
return new SECSHPublicKeyFile(formattedkey);
} catch (IOException ex2) {
throw new IOException(
"Unable to pa... | [
"public",
"static",
"SshPublicKeyFile",
"parse",
"(",
"byte",
"[",
"]",
"formattedkey",
")",
"throws",
"IOException",
"{",
"try",
"{",
"try",
"{",
"return",
"new",
"OpenSSHPublicKeyFile",
"(",
"formattedkey",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
... | Parse a formatted public key and return a file representation.
@param formattedkey
@return SshPublicKeyFile
@throws IOException | [
"Parse",
"a",
"formatted",
"public",
"key",
"and",
"return",
"a",
"file",
"representation",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/publickey/SshPublicKeyFileFactory.java#L143-L160 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/components/DiffieHellmanGroups.java | DiffieHellmanGroups.getSafePrime | public static BigInteger getSafePrime(UnsignedInteger32 maximumSize) {
BigInteger prime = group1;
for(Iterator<BigInteger> it = safePrimes.iterator(); it.hasNext(); ) {
BigInteger p = it.next();
int len = p.bitLength();
if(len > maximumSize.intValue()) {
break;
}
prime = p;
}
return prime... | java | public static BigInteger getSafePrime(UnsignedInteger32 maximumSize) {
BigInteger prime = group1;
for(Iterator<BigInteger> it = safePrimes.iterator(); it.hasNext(); ) {
BigInteger p = it.next();
int len = p.bitLength();
if(len > maximumSize.intValue()) {
break;
}
prime = p;
}
return prime... | [
"public",
"static",
"BigInteger",
"getSafePrime",
"(",
"UnsignedInteger32",
"maximumSize",
")",
"{",
"BigInteger",
"prime",
"=",
"group1",
";",
"for",
"(",
"Iterator",
"<",
"BigInteger",
">",
"it",
"=",
"safePrimes",
".",
"iterator",
"(",
")",
";",
"it",
"."... | get the biggest safe prime from the list that is <= maximumSize
@param maximumSize
@return BigInteger | [
"get",
"the",
"biggest",
"safe",
"prime",
"from",
"the",
"list",
"that",
"is",
"<",
"=",
"maximumSize"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/components/DiffieHellmanGroups.java#L230-L243 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/Socks5Message.java | Socks5Message.read | public void read(InputStream in,boolean clientMode) throws SocksException,
IOException{
data = null;
ip = null;
DataInputStream di = new DataInputStream(in);
version = di.readUnsignedByte();
command = di.readUnsignedByte();
if(clientMode &... | java | public void read(InputStream in,boolean clientMode) throws SocksException,
IOException{
data = null;
ip = null;
DataInputStream di = new DataInputStream(in);
version = di.readUnsignedByte();
command = di.readUnsignedByte();
if(clientMode &... | [
"public",
"void",
"read",
"(",
"InputStream",
"in",
",",
"boolean",
"clientMode",
")",
"throws",
"SocksException",
",",
"IOException",
"{",
"data",
"=",
"null",
";",
"ip",
"=",
"null",
";",
"DataInputStream",
"di",
"=",
"new",
"DataInputStream",
"(",
"in",
... | Initialises Message from the stream. Reads server response or client
request from given stream.
@param in Input stream to read response from.
@param clinetMode If true read server response, else read client request.
@throws SocksException If server response code is not SOCKS_SUCCESS(0) and
reading in client mode, or i... | [
"Initialises",
"Message",
"from",
"the",
"stream",
".",
"Reads",
"server",
"response",
"or",
"client",
"request",
"from",
"given",
"stream",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/Socks5Message.java#L175-L222 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/Socks5Message.java | Socks5Message.write | public void write(OutputStream out)throws SocksException,
IOException{
if(data == null){
Socks5Message msg;
if(addrType == SOCKS_ATYP_DOMAINNAME)
msg = new Socks5Message(command,host,port);
else{
if(ip == null){
try... | java | public void write(OutputStream out)throws SocksException,
IOException{
if(data == null){
Socks5Message msg;
if(addrType == SOCKS_ATYP_DOMAINNAME)
msg = new Socks5Message(command,host,port);
else{
if(ip == null){
try... | [
"public",
"void",
"write",
"(",
"OutputStream",
"out",
")",
"throws",
"SocksException",
",",
"IOException",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"Socks5Message",
"msg",
";",
"if",
"(",
"addrType",
"==",
"SOCKS_ATYP_DOMAINNAME",
")",
"msg",
"=",
... | Writes the message to the stream.
@param out Output stream to which message should be written. | [
"Writes",
"the",
"message",
"to",
"the",
"stream",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/Socks5Message.java#L228-L248 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/Socks5Message.java | Socks5Message.getInetAddress | public InetAddress getInetAddress() throws UnknownHostException{
if(ip!=null) return ip;
return (ip=InetAddress.getByName(host));
} | java | public InetAddress getInetAddress() throws UnknownHostException{
if(ip!=null) return ip;
return (ip=InetAddress.getByName(host));
} | [
"public",
"InetAddress",
"getInetAddress",
"(",
")",
"throws",
"UnknownHostException",
"{",
"if",
"(",
"ip",
"!=",
"null",
")",
"return",
"ip",
";",
"return",
"(",
"ip",
"=",
"InetAddress",
".",
"getByName",
"(",
"host",
")",
")",
";",
"}"
] | Returns IP field of the message as IP, if the message was created
with ATYP of HOSTNAME, it will attempt to resolve the hostname,
which might fail.
@throws UnknownHostException if host can't be resolved. | [
"Returns",
"IP",
"field",
"of",
"the",
"message",
"as",
"IP",
"if",
"the",
"message",
"was",
"created",
"with",
"ATYP",
"of",
"HOSTNAME",
"it",
"will",
"attempt",
"to",
"resolve",
"the",
"hostname",
"which",
"might",
"fail",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/Socks5Message.java#L256-L260 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/socks/SocksDialog.java | SocksDialog.run | public void run() {
if (!initProxy()) {
// Check if we have been aborted
if (mode != OK_MODE)
return;
if (net_thread != Thread.currentThread())
return;
mode = COMMAND_MODE;
warning_label.setText("Look up failed.");
warning_label.invalidate();
return;
}
// System.out.println("Done!"... | java | public void run() {
if (!initProxy()) {
// Check if we have been aborted
if (mode != OK_MODE)
return;
if (net_thread != Thread.currentThread())
return;
mode = COMMAND_MODE;
warning_label.setText("Look up failed.");
warning_label.invalidate();
return;
}
// System.out.println("Done!"... | [
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"!",
"initProxy",
"(",
")",
")",
"{",
"// Check if we have been aborted",
"if",
"(",
"mode",
"!=",
"OK_MODE",
")",
"return",
";",
"if",
"(",
"net_thread",
"!=",
"Thread",
".",
"currentThread",
"(",
")",
... | Resolves proxy address in other thread, to avoid annoying blocking in GUI
thread. | [
"Resolves",
"proxy",
"address",
"in",
"other",
"thread",
"to",
"avoid",
"annoying",
"blocking",
"in",
"GUI",
"thread",
"."
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/SocksDialog.java#L219-L241 | train |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java | SftpClient.cdup | public void cdup() throws SftpStatusException, SshException {
SftpFile cd = sftp.getFile(cwd);
SftpFile parent = cd.getParent();
if (parent != null)
cwd = parent.getAbsolutePath();
} | java | public void cdup() throws SftpStatusException, SshException {
SftpFile cd = sftp.getFile(cwd);
SftpFile parent = cd.getParent();
if (parent != null)
cwd = parent.getAbsolutePath();
} | [
"public",
"void",
"cdup",
"(",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"SftpFile",
"cd",
"=",
"sftp",
".",
"getFile",
"(",
"cwd",
")",
";",
"SftpFile",
"parent",
"=",
"cd",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"parent",
"... | Change the working directory to the parent directory
@throws SftpStatusException
@throws SshException | [
"Change",
"the",
"working",
"directory",
"to",
"the",
"parent",
"directory"
] | ce11ceaf0aa0b129b54327a6891973e1e34689f7 | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L468-L477 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.