日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

Java OutputStream close()方法与示例

發布時間:2025/3/11 java 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Java OutputStream close()方法与示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

OutputStream類close()方法 (OutputStream Class close() method)

  • close() method is available in java.io package.

    close()方法在java.io包中可用。

  • close() method is used to close this OutputStream stream and free all system resources linked with this stream and it cannot be re-opened and perform any output operation once it is closed.

    close()方法用于關閉此OutputStream流并釋放與此流鏈接的所有系統資源,并且一旦關閉它就無法重新打開并執行任何輸出操作。

  • close() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    close()方法是一個非靜態方法,只能通過類對象訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。

  • close() method may throw an exception at the time of closing the stream.

    close()方法在關閉流時可能會引發異常。

    IOException: This exception may throw when getting any input/output error while performing.

    IOException :在執行過程中遇到任何輸入/輸出錯誤時,可能引發此異常。

Syntax:

句法:

public void close();

Parameter(s):

參數:

  • It does not accept any parameter.

    它不接受任何參數。

Return value:

返回值:

The return type of the method is void, it returns nothing.

該方法的返回類型為void ,不返回任何內容。

Example:

例:

// Java program to demonstrate the example // of void close() method // of OutputStreamimport java.io.*;public class CloseOfOS {public static void main(String[] args) throws Exception {OutputStream os_stm = null;InputStream is_stm = null;int val = 65;try {// Instantiates FileOutputStream and // FileInputStream os_stm = new FileOutputStream("D:\\includehelp.txt");is_stm = new FileInputStream("D:\\includehelp.txt");// By using close() method is to close// the stream and when we call write, read// after closing the stream will result an // exceptionos_stm.close();// Loop to write byte to the streamfor (int i = 0; i < 3; ++i) {os_stm.write(val);val++;}// Loop to read byte from the streamfor (int i = 0; i < 3; ++i) {char ch = (char) is_stm.read();System.out.println("ch: " + ch);}} catch (Exception ex) {System.out.println("Stream Closed Before...");} finally {// with the help of this block is to// free all necessary resources linked// with the streamif (is_stm != null) {is_stm.close();if (os_stm != null) {os_stm.close();}}}} }

Output

輸出量

Stream Closed Before...

翻譯自: https://www.includehelp.com/java/outputstream-close-method-with-example.aspx

總結

以上是生活随笔為你收集整理的Java OutputStream close()方法与示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 国产污视频| 久久天堂 | 国产精品久久久久久久久久久久久久久久久久 | 日韩av在线免费 | 操欧美女人 | 好吊一区二区三区视频 | 亚洲综合热| 可以看av的网址 | 精品国精品国产自在久不卡 | 亚洲免费在线观看 | 国产免费观看视频 | 亚洲影院中文字幕 | 我不卡一区二区 | 伊人草草 | 国产男女猛烈无遮挡 | 日本亚洲视频 | 亚洲小视频在线播放 | 欧美激情啪啪 | 怡红院成人影院 | 麻豆网站在线观看 | 成人精品久久久午夜福利 | 免费大黄网站 | 青青操视频在线播放 | 99久久婷婷国产一区二区三区 | 久久99精品久久久久久国产越南 | 日韩 欧美 亚洲 国产 | 午夜一级影院 | 色黄视频网站 | 久久疯狂做爰流白浆xx | 久热精品在线观看视频 | 亚洲一区成人在线 | 色播亚洲 | www.黄色 | 黄色福利网 | 日韩熟女精品一区二区三区 | 国产一区午夜 | 天天爽天天爽夜夜爽毛片 | 精品一区二区三区视频日产 | 在线天堂一区 | 99热热热热 | 中文字幕狠狠干 | 在线成人免费视频 | 三级无遮挡 | 成人a视频在线观看 | 另类小说亚洲色图 | 亚洲第一区在线播放 | 午夜tv影院 | h视频在线免费看 | 亚洲欧美日韩专区 | 69av在线视频| 国产欧美激情在线观看 | 久久久看片 | av毛片网| 国产三级精品视频 | www.com毛片| 在线免费观看污 | 成人精品国产 | 粉色视频免费观看 | 国产超碰人人模人人爽人人添 | 国产超碰人人 | 久久精品综合视频 | 成人在线免费视频播放 | 最黄一级片| 一级黄毛片 | 97caoporn| 日韩精品在线网站 | 激情综合久久 | 热99在线观看 | 精品人妻人伦一区二区有限公司 | 素人一区 | 国产日视频 | 樱桃av | 九九九国产 | 天堂av中文 | 亚洲free性xxxx护士白浆 | 影音先锋啪啪资源 | 一区二区日韩电影 | 超碰牛牛| 中文字幕日韩三级片 | 九九热在线精品 | 欧美日在线 | 麻豆视 | 久久调教 | 欧美性在线观看 | 想要xx视频 | 亚洲av中文无码乱人伦在线观看 | 欧洲免费毛片 | 91精品国产乱码久久久久久久久 | 免费黄色在线视频 | 六月丁香色婷婷 | 日日操夜夜爱 | 91精品国产高清一区二区三密臀 | 伊人中文网 | 污污在线免费观看 | 男女操操操 | www.色com| 亚洲成熟少妇视频在线观看 | 婷婷色基地 | 亚洲熟妇一区二区三区 |