jjzjj

FileSystem3

全部标签

scala - java.io.IOException : No FileSystem for scheme : hdfs 异常

我正在使用ClouderaQuickstartVMCDH5.3.0(就包裹包而言)和Spark1.2.0$SPARK_HOME=/opt/cloudera/parcels/CDH-5.3.0-1.cdh5.3.0.p0.30/lib/spark并使用命令提交Spark应用./bin/spark-submit--class--masterspark://localhost.localdomain:7077--deploy-modeclient--executor-memory4G../apps/.jarSpark_App_Main_Class_Name.scalaimportorg.ap

java.lang.UnsupportedOperationException : Not implemented by the DistributedFileSystem FileSystem implementation during FileSystem. 获取()

请查找随附的代码片段。我正在使用此代码将文件从hdfs下载到我的本地文件系统-Configurationconf=newConfiguration();FileSystemhdfsFileSystem=FileSystem.get(conf);Pathlocal=newPath(destinationPath);Pathhdfs=newPath(sourcePath);StringfileName=hdfs.getName();if(hdfsFileSystem.exists(hdfs)){hdfsFileSystem.copyToLocalFile(false,hdfs,local,

java - 在 FileSystem.liststatus 中过滤日志文件(_success 和 _log)

您好,在使用FileSystem.listStatus方法时,我想过滤日志文件并仅列出不是日志文件的文件。我该怎么做?谢谢 最佳答案 如果您在源代码中查找FileInputFormat(第62行)他们有一个私有(private)静态PathFilter,它会忽略以下划线或句点开头的文件。由于它是私有(private)的,你必须复制代码,或者如果你的输入文件总是以部分开头(即你没有使用MultipleOutputs),你的答案就足够了 关于java-在FileSystem.liststat

java - 多个 Hadoop FileSystem 实例

我有一个类(为了便于阅读,我删除了try/catch):publicclassHadoopFileSystem{privateFileSystemm_fileSystem=null;publicHadoopFileSystem(){Configurationl_configuration=newConfiguration();l_configuration.set("fs.default.name","hdfs://localhost:9100");l_configuration.set("mapred.job.tracker","localhost:9101");m_fileSyst

c++ - filesystem::canonical 能否用于防止传递给 fstream 的文件路径的文件路径注入(inject)

我有一个公共(public)文件夹pub,里面有子文件夹和文件。用户现在给我一个相对文件路径,我执行一些映射,然后使用fstream读取文件并将其返回给用户。现在的问题是,如果用户给我一条路径,例如../fileXY.txt或其他考虑路径遍历或其他类型的文件路径注入(inject)的奇特内容。fstream只是接受它并读取我的公共(public)pub文件夹之外的潜在文件,或者更糟的是给他们一个我系统上所有文件的列表等......。在重新发明轮子之前,我在文件系统库中搜索我看到有这个std::filesystem::canonical函数并且有很多关于范式的讨论。我在这里有一个一般性问

c++ - 将 Boost FileSystem3 迭代器转换为 const char*

我正在使用BoostFileSystem3循环遍历目录中的一些文件,我需要将文件名转换为char*以用于另一个库,不幸的是我的C++foo缺失,任何人都可以帮忙吗?intmain(intargc,char*argv[]){pathp(argv[1]);//preadsclearerthanargv[1]inthefollowingcodetry{if(exists(p))//doespactuallyexist?{if(is_regular_file(p))//isparegularfile?coutvec;//storepaths,vecv;//sowecansortthemlate

c++ - 为什么 boost::filesystem::path::string() 在 Windows 上按值返回,而在 POSIX 上按引用返回?

来自boost/filesystem/path.hpp:#ifdefBOOST_WINDOWS_APIconststd::stringstring()const{[...]}#else//BOOST_POSIX_API//string_typeisstd::string,sothereisnoconversionconststd::string&string()const{returnm_pathname;}[...]#endif对于wstring()来说恰恰相反——在Windows上通过引用返回,在POSIX上通过值返回。这有什么有趣的原因吗? 最佳答案

c++ - 使用 boost::filesystem 时出现链接器错误?

我有以下代码:#include#includeintmain(){constchar*file_path="my_path";std::cout当我构建时出现以下错误:1>Main.obj:errorLNK2019:unresolvedexternalsymbol"classboost::system::error_categoryconst&__cdeclboost::system::system_category(void)"(?system_category@system@boost@@YAAEBVerror_category@12@XZ)referencedinfunction

c++ - Boost.Filesystem 中的 MAX_PATH 限制

我想使用Boost.Filesystem库来操作路径、文件和目录。我的问题是是否支持长于MAX_PATH的路径?我知道在Win32API中我们有解决方法“\\?\”,但它不受PathAppend和PathCombine等基本函数的支持。所以我正在寻找有关MAX_PATH和Boost.FS的任何有用信息。谢谢UPD:我关心所有操作,如路径追加、路径合并等(我在Win32API中有这些函数,但它们不适用于比MAX_PATH长的路径)例如CreateFileW和DeleteFileW都支持比MAX_PATH长的路径。可能Boost.FS可以替代Win32API实用程序函数,例如shlwapi

c++ - 如何使用 Boost Filesystem Library v3 确定文件是否包含在路径中?

如何确定文件是否包含在boost文件系统v3的路径中。我看到有一个lesser或greater运算符,但这似乎只是词法上的。我看到的最佳方式如下:取文件和路径的两个绝对路径删除文件的最后一部分并查看它是否等于路径(如果是则包含)有没有更好的方法来做到这一点? 最佳答案 以下函数应确定文件名是否位于给定目录中的某个位置,作为直接子目录还是在某个子目录中。boolpath_contains_file(pathdir,pathfile){//Ifdirendswith"/"andisn'ttherootdirectory,thenthef