首页 \ 问答 \ 需要SFTP InputStream的URL(need URL for SFTP InputStream)

需要SFTP InputStream的URL(need URL for SFTP InputStream)

我正在编写一个需要通过sftp连接到服务器上的GATE数据存储的应用程序。 为了打开数据存储,我需要有它的网址。 我在Jsch类的帮助下通过sftp和公钥/私钥授权访问数据存储。

我可以通过ChannelSftp获取数据,然后获取相应目录的InputStream 。 我试图用sftp.getHome()来获取路径,但是这只给了我相对路径。 但是,为了连接到数据存储,我需要这样的东西:

"sftp://path/to/datastore"

有没有办法获得sftp InputStream的url?

我知道我可以将InputStream中的数据加载到本地文件中,但我不想那样做,因为数据存储很大。 我也知道我可以通过在URL中输入用户名和密码来连接到sftp,但我想使用公钥。


I am writing an application that needs to connect via sftp to a GATE datastore that is living on a server. In order to open the datastore, I need to have the url for it. I am accessing the datastore through sftp and public/private key authorization with help of the Jsch class.

I can get to the data with ChannelSftp and then get an InputStream for the respective directory. I tried to get the path with sftp.getHome(), but that only gives me the relative path. In order to connect to the datastore, though, I need something like:

"sftp://path/to/datastore"

Is there a way to get the url of the sftp InputStream?

I know I could load the data from the InputStream to a local file, but I don't want to do that, because the datastore is huge. I also know that I can connect to sftp by putting username and password in the url, but I want to use a public key.


原文:https://stackoverflow.com/questions/41164583
更新时间:2024-03-15 07:03

最满意答案

您可以使用变量插值以更加奇特的方式实现它,这样每次需要增加类/修饰符的特异性时都可以使用它。 一开始看起来很奇怪,但是当你习惯它时,你会喜欢它,你的代码看起来会更干净,更容易阅读。

查看官方文档

.block__element {
    @this: block__element;
    background: red;

    &.@{this}--modifier-primary {
        background: yellow;
    }

    &.@{this}--modifier-secondary {
        background: green;
    }

    &.@{this}--modifier-tertiary {
        background: green;
    }
}

.block__element {
    background: red;
    &&--modifier {
        background: yellow;
    }
}

link

相关问答

更多
  • 您可以使用变量插值以更加奇特的方式实现它,这样每次需要增加类/修饰符的特异性时都可以使用它。 一开始看起来很奇怪,但是当你习惯它时,你会喜欢它,你的代码看起来会更干净,更容易阅读。 查看官方文档 .block__element { @this: block__element; background: red; &.@{this}--modifier-primary { background: yellow; } &.@{this}--modifie ...
  • 您a元素没有类barLinks 。 做这个: #rightBar .barLinks a { text-decoration: underline; } 示例: http : //jsfiddle.net/J34mj/2/ Your a element does not have the class barLinks. Do this: #rightBar .barLinks a { text-decoration: underline; } example: http://jsfidd ...
  • 虽然ID选择器确实提供了比CSS中的类选择器更多的特异性 ,但实际上并不是这里发生的事情,因为这两个规则并不针对相同的元素。 你实际处理的是一个类选择器,它针对一个元素而不是一个继承的样式。 .c3没有直接定位它的规则,但从#id1继承父颜色,因此它是蓝色的。 相反, .c2继承父颜色,然后将类选择器应用于它, 覆盖继承,并使其变为红色: .c2 { color: red; } #id1 { color: blue; }
  • 你添加数字以获得特异性的想法实际上是错误的。 计算结果在大多数情况下是相同的,但是您已经找到了它不同的边缘情况。 从W3C CSS2规范 : 连接四个数字abcd(在具有大基数的数字系统中)给出了特异性。 如果您按照该页面中的示例进行操作,则会发现规则的具体情况如下: .a1 .a2 .a3 .a4 .a5 .a6 .a7 .a8 .a9 .a10 .a11 .a12 .a13 || 0,0,13,0 #id1 ...
  • 问题是13和px之间的空白。 删除它,然后它应该工作: #BizIdName { font-family: Arial; font-size: 13px; font-weight: normal; color: #333; text-decoration: none; } The problem is the whitespace between the 13 and the px. Remove it, then it should work: #BizIdNam ...
  • 逗号选择器不服从分配属性。 ab, c匹配ab和c ; 它不等于ac 。 因此,您的#emailField input选择器比.ui-state-error更具体(因为它包含ID选择器),而textarea则不太具体(因为它不包含ID选择器)。 Comma selectors do not obey the distributive property. a b, c matches a b and c; it is not equivalent to a c. Therefore, your #emailF ...
  • 您可以使用E > F子选择器作为问题的解决方案: div.green_colour > div.has_colour{ background-color: green; } div.red_colour > div.has_colour{ background-color: red; } 根据此图表http://www.quirksmode.org/css/contents.html,它与所有主流浏览器和IE 7+兼容 如果您有兴趣,还有其他方法可以实现上述解决方案(例如通过javascript) ...
  • 如MDN所述, ID胜过类特异性: 以下选择器列表是通过增加特异性: 通用选择器 类型选择器 类选择器 属性选择器 伪类 ID选择器 内联样式 特异性计算可能有点令人困惑,但您需要记住,正如W3所述 ,在计算连接的特异性时,不要将数字加在一起。 例如: #id具有特异性= 0,1,0,0 .abcdefghijkl的特异性= 0,0,12,0 所以,是的,ID每次都会胜过纯粹的类选择。 ID trumps class specificity as MDN states: The following list ...
  • 这是由于特殊性 :尽管a是一个元素类型选择器,它不如类选择器特有,但它伴随着一个:link伪类,它与.button类同样具体。 因此,类型+伪类将比类更具体。 这里没有继承,因为没有父元素样式,我可以看到它们应用于元素。 继承是指从父元素采用样式。 当你看到链接显示蓝色而不是白色时,那就是工作中的级联 ,而不是继承。 地区不是CSS术语(至少不在其词汇表中),所以我不确定你的意思。 如果您需要您的号召性用语按钮为白色,则只需给它a选择器即可,因此您的选择器同样具体,最后的声明优先: a:link {font ...
  • 不是哪一个在你的班级中首先出现=“......”这个重要的顺序,它是哪一个在你的css规则中写的最重要的。 这就是为什么它的所谓级联样式表,因为最后一个相关规则,具有相同或更高的特异性将被应用。 因此,如果您的所有规则都在外部工作表中,并且如果它们具有相同的特异性,则将应用最后一个规则。 但内联/内部样式优先于外部样式。 (虽然这并不意味着你应该使用它们) It's not which one comes first in your class="..." order that matters, it's ...
  • 相关文章

    更多

    最新问答

    更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)