java - 创建新文件时如何停止 Groovy 用单个正斜杠替换多个正斜杠
问题描述
我通过 aws S3 访问了以下文件:
s3://ngi-igenomes/igenomes/Homo_sapiens/NCBI/GRCh38/Annotation/Genes/genes.gtf
我制作了一个检查文件内容的函数,并且适用于本地文件。考虑以下:
gtf_file_str = 's3://ngi-igenomes/igenomes/Homo_sapiens/NCBI/GRCh38/Annotation/Genes/genes.gtf'
println gtf_file_str
File gtf_file = new File(gtf_file_str)
println gtf_file
执行此操作时,我得到以下信息:
s3://ngi-igenomes/igenomes/Homo_sapiens/NCBI/GRCh38/Annotation/Genes/genes.gtf
s3:/ngi-igenomes/igenomes/Homo_sapiens/NCBI/GRCh38/Annotation/Genes/genes.gtf
然后我的函数无法识别gtf_file
,因为它已经摆脱了双正斜杠并将其替换为单斜杠。如何阻止它替换双正斜杠?
解决方案
推荐阅读
- java - Angular2 与 JSP 或 javaEE 的集成
- cassandra - 如何在 openshift 中访问 Cassandra 数据库
- verification - Dafny,调用可能违反上下文的修改子句
- javascript - 使用 Mongoose 软删除不起作用
- ruby-on-rails - JSON 数据在开发中正确显示,但在生产中未正确显示
- ios - 不允许在文本字段中使用 AZ 和 0-9 数字
- ios - IOS/Objective-C:核心数据获取中的 NSPredicate 和 NULL 值
- android - RecyclerView 不要在角落剪辑项目
- android - 短划线宽度在android中的不同手机上有所不同
- google-maps - Google Maps KML zIndex 属性未更改图层显示顺序