iT邦幫忙

DAY 21
0

Java重點學習筆記系列 第 21

Java重點筆記 19:OutputStream 與 FileOutputStream

  • 分享至 

  • xImage
  •  

和相InputStream與FileInputStream一樣,Java提供OutputStream與FileOutputStream,用來處理文件寫入操作。同樣的OutputStream是FileOutputStream的上層(父層)。可用FileOutputStream來建立一個OutputStream的方法,然後用OutputStream的方法(methods)進行操作。

OutputStream f = new FileOutputStream("C:/java/hello") 

以下是OutputStream的方法(methods):

1	public void close() throws IOException{}
This method closes the file output stream. Releases any system resources associated with the file. Throws an IOException.
2	protected void finalize()throws IOException {}
This method cleans up the connection to the file. Ensures that the close method of this file output stream is called when there are no more references to this stream. Throws an IOException.
3	public void write(int w)throws IOException{}
This methods writes the specified byte to the output stream.
4	public void write(byte[] w)
Writes w.length bytes from the mentioned byte array to the OutputStream.

上一篇
Java重點筆記十八:InputStream 與 FileInputStream
下一篇
Java重點筆記 20:Java中的文件目錄操作
系列文
Java重點學習筆記30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言