本文整理了Java中com.jcraft.jsch.Session.getConfig()
方法的一些代码示例,展示了Session.getConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.getConfig()
方法的具体详情如下:
包路径:com.jcraft.jsch.Session
类名称:Session
方法名:getConfig
[英]Retrieves a configuration option of this session. This is also used internally. If some option is not set for the session, this method returns the default value set at JSch#setConfig.
[中]检索此会话的配置选项。这也在内部使用。如果没有为会话设置某些选项,此方法将返回在JSch#setConfig处设置的默认值。
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
private static void setPreferredKeyTypesOrder(Session session) {
HostKeyRepository hkr = session.getHostKeyRepository();
List<String> known = Stream.of(hkr.getHostKey(hostName(session), null))
.map(HostKey::getType)
.collect(toList());
if (!known.isEmpty()) {
String serverHostKey = "server_host_key"; //$NON-NLS-1$
String current = session.getConfig(serverHostKey);
if (current == null) {
session.setConfig(serverHostKey, String.join(",", known)); //$NON-NLS-1$
return;
}
String knownFirst = Stream.concat(
known.stream(),
Stream.of(current.split(",")) //$NON-NLS-1$
.filter(s -> !known.contains(s)))
.collect(joining(",")); //$NON-NLS-1$
session.setConfig(serverHostKey, knownFirst);
}
}
代码示例来源:origin: org.xbib/jsch-core
public String getFingerPrint() {
HASH hash = null;
try {
Class<?> c = Class.forName(session.getConfig("md5"));
hash = (HASH) (c.newInstance());
} catch (Exception e) {
logger.log(Level.SEVERE, "getFingerPrint: " + e.getMessage());
}
return Util.getFingerPrint(hash, getHostKey());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch
public String getFingerPrint(){
HASH hash=null;
try{
Class c=Class.forName(session.getConfig("md5"));
hash=(HASH)(c.newInstance());
}
catch(Exception e){ System.err.println("getFingerPrint: "+e); }
return Util.getFingerPrint(hash, getHostKey());
}
byte[] getK(){ return K; }
代码示例来源:origin: com.jcraft.jsch/com.springsource.com.jcraft.jsch
public String getFingerPrint(){
HASH hash=null;
try{
Class c=Class.forName(session.getConfig("md5"));
hash=(HASH)(c.newInstance());
}
catch(Exception e){ System.err.println("getFingerPrint: "+e); }
return Util.getFingerPrint(hash, getHostKey());
}
byte[] getK(){ return K; }
代码示例来源:origin: org.mule.jsch/jsch
public String getFingerPrint(){
HASH hash=null;
try{
Class c=Class.forName(session.getConfig("md5"));
hash=(HASH)(c.newInstance());
}
catch(Exception e){ System.err.println("getFingerPrint: "+e); }
return Util.getFingerPrint(hash, getHostKey());
}
byte[] getK(){ return K; }
代码示例来源:origin: org.xbib/jsch-core
private String[] checkKexes(String kexes) {
if (kexes == null || kexes.length() == 0)
return null;
logger.log(Level.FINE, () -> "CheckKexes: " + kexes);
List<String> result = new ArrayList<>();
String[] _kexes = Util.split(kexes, ",");
for (String _kexe : _kexes) {
if (!checkKex(this, getConfig(_kexe))) {
result.add(_kexe);
}
}
if (result.size() == 0)
return null;
String[] foo = new String[result.size()];
System.arraycopy(result.toArray(), 0, foo, 0, result.size());
for (String aFoo : foo) {
logger.log(Level.FINE, aFoo + " is not available.");
}
return foo;
}
代码示例来源:origin: org.xbib/jsch-core
private void initInflater(String method) throws JSchException {
if (method.equals("none")) {
inflater = null;
return;
}
String foo = getConfig(method);
if (foo != null) {
if (method.equals("zlib") ||
(isAuthed && method.equals("zlib@openssh.com"))) {
try {
Class<?> c = Class.forName(foo);
inflater = (Compression) (c.newInstance());
inflater.init(Compression.INFLATER, 0);
} catch (Exception ee) {
throw new JSchException(ee.toString(), ee);
}
}
}
}
代码示例来源:origin: org.mule.jsch/jsch
private void initInflater(String method) throws JSchException{
if(method.equals("none")){
inflater=null;
return;
}
String foo=getConfig(method);
if(foo!=null){
if(method.equals("zlib") ||
(isAuthed && method.equals("zlib@openssh.com"))){
try{
Class c=Class.forName(foo);
inflater=(Compression)(c.newInstance());
inflater.init(Compression.INFLATER, 0);
}
catch(Exception ee){
throw new JSchException(ee.toString(), ee);
//System.err.println(foo+" isn't accessible.");
}
}
}
}
代码示例来源:origin: berlam/github-bucket
private static void setPreferredKeyTypesOrder(Session session) {
HostKeyRepository hkr = session.getHostKeyRepository();
List<String> known = Stream.of(hkr.getHostKey(hostName(session), null))
.map(HostKey::getType)
.collect(toList());
if (!known.isEmpty()) {
String serverHostKey = "server_host_key"; //$NON-NLS-1$
String current = session.getConfig(serverHostKey);
if (current == null) {
session.setConfig(serverHostKey, String.join(",", known)); //$NON-NLS-1$
return;
}
String knownFirst = Stream.concat(
known.stream(),
Stream.of(current.split(",")) //$NON-NLS-1$
.filter(s -> !known.contains(s)))
.collect(joining(",")); //$NON-NLS-1$
session.setConfig(serverHostKey, knownFirst);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch
private void initInflater(String method) throws JSchException{
if(method.equals("none")){
inflater=null;
return;
}
String foo=getConfig(method);
if(foo!=null){
if(method.equals("zlib") ||
(isAuthed && method.equals("zlib@openssh.com"))){
try{
Class c=Class.forName(foo);
inflater=(Compression)(c.newInstance());
inflater.init(Compression.INFLATER, 0);
}
catch(Exception ee){
throw new JSchException(ee.toString(), ee);
//System.err.println(foo+" isn't accessible.");
}
}
}
}
代码示例来源:origin: com.jcraft.jsch/com.springsource.com.jcraft.jsch
private void initInflater(String method) throws JSchException{
if(method.equals("none")){
inflater=null;
return;
}
String foo=getConfig(method);
if(foo!=null){
if(method.equals("zlib") ||
(isAuthed && method.equals("zlib@openssh.com"))){
try{
Class c=Class.forName(foo);
inflater=(Compression)(c.newInstance());
inflater.init(Compression.INFLATER, 0);
}
catch(Exception ee){
throw new JSchException(ee.toString(), ee);
//System.err.println(foo+" isn't accessible.");
}
}
}
}
代码示例来源:origin: ePaul/jsch-documentation
/**
* returns the finger print of the server's public key.
*
* This uses the {@link HASH} implementation given by
* {@link Session#getConfig(String) session.getConfig("md5")}.
* @return the (lowercase) hexadecimal representation of
* the MD5 hash of the server's public key.
*/
public String getFingerPrint(){
HASH hash=null;
try{
Class c=Class.forName(session.getConfig("md5"));
hash=(HASH)(c.newInstance());
}
catch(Exception e){ System.err.println("getFingerPrint: "+e); }
return Util.getFingerPrint(hash, getHostKey());
}
byte[] getK(){ return K; }
代码示例来源:origin: org.xbib/jsch-core
public InputStream getExtInputStream() throws IOException {
int max_input_buffer_size = 32 * 1024;
try {
max_input_buffer_size =
Integer.parseInt(getSession().getConfig("max_input_buffer_size"));
} catch (Exception e) {
}
PipedInputStream in =
new MyPipedInputStream(
32 * 1024, // this value should be customizable.
max_input_buffer_size
);
boolean resizable = 32 * 1024 < max_input_buffer_size;
io.setExtOutputStream(new PassiveOutputStream(in, resizable), false);
return in;
}
代码示例来源:origin: org.mule.jsch/jsch
public InputStream getExtInputStream() throws IOException {
int max_input_buffer_size = 32*1024;
try {
max_input_buffer_size =
Integer.parseInt(getSession().getConfig("max_input_buffer_size"));
}
catch(Exception e){}
PipedInputStream in =
new MyPipedInputStream(
32*1024, // this value should be customizable.
max_input_buffer_size
);
boolean resizable = 32*1024<max_input_buffer_size;
io.setExtOutputStream(new PassiveOutputStream(in, resizable), false);
return in;
}
public OutputStream getOutputStream() throws IOException {
代码示例来源:origin: org.xbib/jsch-core
public InputStream getInputStream() throws IOException {
int max_input_buffer_size = 32 * 1024;
try {
max_input_buffer_size =
Integer.parseInt(getSession().getConfig("max_input_buffer_size"));
} catch (Exception e) {
}
PipedInputStream in =
new MyPipedInputStream(
32 * 1024, // this value should be customizable.
max_input_buffer_size
);
boolean resizable = 32 * 1024 < max_input_buffer_size;
io.setOutputStream(new PassiveOutputStream(in, resizable), false);
return in;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch
public InputStream getExtInputStream() throws IOException {
int max_input_buffer_size = 32*1024;
try {
max_input_buffer_size =
Integer.parseInt(getSession().getConfig("max_input_buffer_size"));
}
catch(Exception e){}
PipedInputStream in =
new MyPipedInputStream(
32*1024, // this value should be customizable.
max_input_buffer_size
);
boolean resizable = 32*1024<max_input_buffer_size;
io.setExtOutputStream(new PassiveOutputStream(in, resizable), false);
return in;
}
public OutputStream getOutputStream() throws IOException {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch
public InputStream getInputStream() throws IOException {
int max_input_buffer_size = 32*1024;
try {
max_input_buffer_size =
Integer.parseInt(getSession().getConfig("max_input_buffer_size"));
}
catch(Exception e){}
PipedInputStream in =
new MyPipedInputStream(
32*1024, // this value should be customizable.
max_input_buffer_size
);
boolean resizable = 32*1024<max_input_buffer_size;
io.setOutputStream(new PassiveOutputStream(in, resizable), false);
return in;
}
public InputStream getExtInputStream() throws IOException {
代码示例来源:origin: org.mule.jsch/jsch
public InputStream getInputStream() throws IOException {
int max_input_buffer_size = 32*1024;
try {
max_input_buffer_size =
Integer.parseInt(getSession().getConfig("max_input_buffer_size"));
}
catch(Exception e){}
PipedInputStream in =
new MyPipedInputStream(
32*1024, // this value should be customizable.
max_input_buffer_size
);
boolean resizable = 32*1024<max_input_buffer_size;
io.setOutputStream(new PassiveOutputStream(in, resizable), false);
return in;
}
public InputStream getExtInputStream() throws IOException {
代码示例来源:origin: org.mule.jsch/jsch
private void requestPortForwarding() throws JSchException {
if(getConfig("ClearAllForwardings").equals("yes"))
return;
ConfigRepository configRepository = jsch.getConfigRepository();
if(configRepository == null){
return;
}
ConfigRepository.Config config =
configRepository.getConfig(org_host);
String[] values = config.getValues("LocalForward");
if(values != null){
for(int i = 0; i < values.length; i++) {
setPortForwardingL(values[i]);
}
}
values = config.getValues("RemoteForward");
if(values != null){
for(int i = 0; i < values.length; i++) {
setPortForwardingR(values[i]);
}
}
}
代码示例来源:origin: org.xbib/jsch-core
private void requestPortForwarding() throws JSchException {
if (getConfig("ClearAllForwardings").equals("yes"))
return;
ConfigRepository configRepository = jsch.getConfigRepository();
if (configRepository == null) {
return;
}
ConfigRepository.Config config =
configRepository.getConfig(org_host);
String[] values = config.getValues("LocalForward");
if (values != null) {
for (int i = 0; i < values.length; i++) {
setPortForwardingL(values[i]);
}
}
values = config.getValues("RemoteForward");
if (values != null) {
for (int i = 0; i < values.length; i++) {
setPortForwardingR(values[i]);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!