file file = new file("text.txt");//只是file本身,不能進行讀寫
//********寫入*********//
printwriter printwriter = null;
try catch (filenotfoundexception e) finally
//********讀取*********//
//******寫入*******//
fileoutputstream fileoutputstream = null;
try catch (ioexception e) finally catch (ioexception e)
} //*****讀取********//
fileinputstream inputstream = null;
try
} catch (exception e) finally catch (exception e2)
}
//********寫入*********//
dataoutputstream dataoutputstream = null;
try catch (exception e) finally catch (ioexception e)
} //********讀取*********//
datainputstream datainputstream = null;
try catch(eofexception e) catch (exception e) finally catch (ioexception e)
}
減少磁碟的讀寫次數來提高輸入輸出的速度
//********寫入*********//
bufferedoutputstream bufferedoutputstream = null;
try catch (exception e) finally catch (ioexception e)
} //********讀取*********//
bufferedinputstream bufferedinputstream = null;
try
} catch (exception e) finally catch (ioexception e)
}
讀寫序列化(serializable)物件
public class main catch (exception e) finally catch (ioexception e)
} //******讀取*****//
objectinputstream objectinputstream = null;
try catch (exception e) finally catch (ioexception e)
} }}class a implements serializable
}
randomaccessfile randomaccessfile = null;
try catch (exception e) finally catch (ioexception e)
}
java 檔案讀寫
一.獲得控制台使用者輸入的資訊 獲得控制台使用者輸入的資訊 return throws ioexception public string getinputmessage throws ioexception.五.轉移檔案目錄 轉移檔案目錄不等同於複製檔案,複製檔案是複製後兩個目錄都存在該檔案,而轉...
java 檔案讀寫
response.reset 非常重要 url u new url file filepath response.setcontenttype u.openconnection getcontenttype response.setheader content disposition inline ...
Java讀寫檔案
有個100萬行的錯誤日誌,且異常資訊種類不多,但是重複的比較多,要求統計具體方法在哪種異常資訊出現了多少次。因為某種異常中可能出現這個方法,也可能不出現,所以利用notepad 統計就不好使了,思來想去只有利用檔案讀寫操作,來解決這個問題了。日誌檔案中每乙個異常開頭都是日期,格式為yyyy mm d...