FileUtils方法大全 2

2021-08-26 12:41:43 字數 2796 閱讀 9603

安靜模式刪除目錄,操作過程中會丟擲異常deletequietly(file file)

publicstatic boolean deletequietly(file file)

try

} catch (exception ignored)

try  catch (exception ignored) 

}

清除乙個目錄而不刪除它cleandirectory(filedirectory)

publicstatic void cleandirectory(file directory) throws ioexception

if (!directory.isdirectory()) 

file files =directory.listfiles();

if (files == null)

ioexception exception = null;

for (file file : files) catch (ioexception ioe)

}if (null != exception)

}

等待nfs來傳播乙個檔案的建立,實施超時waitfor(file file, int seconds)

publicstatic boolean waitfor(file file, int seconds)

} try catch (interruptedexceptionignore) catch (exception ex)

} return true;

} 把乙個檔案的內容讀取到乙個對應編碼的字串中去readfiletostring(file file, string encoding)

public static string readfiletostring(filefile, string encoding) throws ioexception finally

} 讀取檔案的內容到虛擬機器的預設編碼字串readfiletostring(file file)

public static string readfiletostring(filefile) throws ioexception

把乙個檔案轉換成位元組陣列返回readfiletobytearray(file file)

public static byte readfiletobytearray(filefile) throws ioexception finally

} 把檔案中的內容逐行的拷貝到乙個對應編碼的list中去

publicstatic list readlines(file file, string encoding) throwsioexception finally

} 把檔案中的內容逐行的拷貝到乙個虛擬機器預設編碼的list中去

public static listreadlines(file file) throws ioexception

根據對應編碼返回對應檔案內容的行迭代器lineiterator(file file, string encoding)

publicstatic lineiterator lineiterator(file file, string encoding) throws ioexception catch (ioexception ex) catch (runtimeexception ex)

} 根據虛擬機器預設編碼返回對應檔案內容的行迭代器lineiterator(file file)

public static lineiterator lineiterator(filefile) throws ioexception

根據對應編碼把字串寫進對應的檔案中writestringtofile(file file, string data, string encoding)

publicstatic void writestringtofile(file file, string data, string encoding) throwsioexception finally

} 根據虛擬機器預設編碼把字串寫進對應的檔案中writestringtofile(file file, string data)

public static void writestringtofile(filefile, string data) throws ioexception

根據虛擬機器預設的編碼把charsequence寫入到檔案中(file file, charsequence data)

public static void write(file file, charsequence data) throwsioexception

根據對應的編碼把charsequence寫入到檔案中write(file file, charsequence data, string encoding)

publicstatic void write(file file, charsequence data, string encoding) throwsioexception

把乙個位元組陣列寫入到指定的檔案中writebytearraytofile(file file, byte data)

public static void writebytearraytofile(filefile, byte data) throws ioexception finally

} 把集合中的內容根據對應編碼逐項插入到檔案中writelines(file file, string encoding, collection

python selenium2 的方法大全

driver.find element by id driver.find element by name driver.find element by class driver.find element by tag name driver.find element by xpath driver...

jQuery HTML CSS 方法大全

方法 描述addclass 向所選元素新增乙個或多個類名 after 在所選元素之後插入內容 在所選元素的末尾插入內容 在所選元素的末尾插入html元素 attr 設定或返回所選元素的屬性 值 before 在所選元素之前插入內容 clone 轉殖所選元素的副本 css 為所選元素設定或返回乙個或多...

typedef使用大全2

defines s printf s n s s typedefstruct ts1ts1,pts1,pppts1 ts1 是結構體的名稱,pts1 是結構體指標的名稱 也就是將結構體 struct ts1 命名為ts1,將struct ts1 命名為pts1 將struct ts1 命名為pppt...