1. 程式人生 > >踩坑:fileSystem.copyToLocalFile兩個引數 空指標異常

踩坑:fileSystem.copyToLocalFile兩個引數 空指標異常

踩坑:fileSystem.copyToLocalFile(Path src, Path dst) 空指標異常

標籤(空格分隔): 踩坑

在網上一搜,直接改成fileSystem.copyToLocalFile(false,xx,xx,true)即可。

但是基本上就這一句,也不說為啥,還是自己查API吧:

public void copyToLocalFile(boolean delSrc,
                   Path src,
                   Path dst,
                   boolean useRawLocalFileSystem)
                     throws IOException

The src file
is under this filesystem, and the dst is on the local disk. Copy it from the remote filesystem to the local dst name. delSrc indicates if the src will be removed or not. useRawLocalFileSystem indicates whether to use RawLocalFileSystem as the local file system or not. RawLocalFileSystem is non checksumming, So, It will not
create any crc files at local. Parameters: delSrc - whether to delete the src src - path dst - path useRawLocalFileSystem - whether to use RawLocalFileSystem as local file system or not. Throws: IOException - for any IO error

src檔案位於此檔案系統下,dst位於本地磁碟上。將其從遠端檔案系統複製到本地dst名稱。delSrc指示src是否會被刪除。useRawLocalFileSystem指示是否使用RawLocalFileSystem作為本地檔案系統。RawLocalFileSystem不是校驗和,所以它不會在本地建立任何crc檔案。

  • delSrc : 是否刪除src
  • useRawLocalFileSystem:是否使用RawLocalFileSystem作為本地檔案系統。